177 lines
8.2 KiB
C#
177 lines
8.2 KiB
C#
|
using FizzyLauncher.Models;
|
|||
|
using RyzStudio.Windows.ThemedForms;
|
|||
|
using System;
|
|||
|
|
|||
|
namespace FizzyLauncher.Windows.Forms
|
|||
|
{
|
|||
|
public class EditGroupForm : TDialogForm
|
|||
|
{
|
|||
|
public static void ShowDialog(TilePanelLayout control)
|
|||
|
{
|
|||
|
EditGroupForm form = new EditGroupForm();
|
|||
|
form.TilePanelLayout = control;
|
|||
|
form.ShowDialog();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private System.Windows.Forms.Label label2;
|
|||
|
private System.Windows.Forms.Label label1;
|
|||
|
private TButton button1;
|
|||
|
private TPickerBox pickerBox1;
|
|||
|
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
|
|||
|
private TTextBox textBox1;
|
|||
|
|
|||
|
|
|||
|
public EditGroupForm() : base()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
|
|||
|
pickerBox1.ComboBox.Items.Clear();
|
|||
|
pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
|
|||
|
if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0;
|
|||
|
}
|
|||
|
|
|||
|
private void InitializeComponent()
|
|||
|
{
|
|||
|
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
|
|||
|
this.label2 = new System.Windows.Forms.Label();
|
|||
|
this.label1 = new System.Windows.Forms.Label();
|
|||
|
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
|
|||
|
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox();
|
|||
|
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
|||
|
this.SuspendLayout();
|
|||
|
//
|
|||
|
// textBox1
|
|||
|
//
|
|||
|
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|||
|
this.textBox1.BackColor = System.Drawing.Color.Transparent;
|
|||
|
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
|||
|
this.textBox1.Location = new System.Drawing.Point(192, 20);
|
|||
|
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
|
|||
|
this.textBox1.Name = "textBox1";
|
|||
|
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
|
|||
|
this.textBox1.Size = new System.Drawing.Size(177, 35);
|
|||
|
this.textBox1.SubmitButton = null;
|
|||
|
this.textBox1.TabIndex = 152;
|
|||
|
this.textBox1.UseSystemPasswordChar = false;
|
|||
|
//
|
|||
|
// label2
|
|||
|
//
|
|||
|
this.label2.AutoSize = true;
|
|||
|
this.label2.BackColor = System.Drawing.Color.Transparent;
|
|||
|
this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
|
|||
|
this.label2.Location = new System.Drawing.Point(10, 62);
|
|||
|
this.label2.Name = "label2";
|
|||
|
this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
|||
|
this.label2.Size = new System.Drawing.Size(119, 34);
|
|||
|
this.label2.TabIndex = 155;
|
|||
|
this.label2.Text = "Show Only Expanded";
|
|||
|
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|||
|
//
|
|||
|
// label1
|
|||
|
//
|
|||
|
this.label1.AutoSize = true;
|
|||
|
this.label1.BackColor = System.Drawing.Color.Transparent;
|
|||
|
this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
|
|||
|
this.label1.Location = new System.Drawing.Point(10, 21);
|
|||
|
this.label1.Margin = new System.Windows.Forms.Padding(0);
|
|||
|
this.label1.Name = "label1";
|
|||
|
this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
|||
|
this.label1.Size = new System.Drawing.Size(29, 34);
|
|||
|
this.label1.TabIndex = 153;
|
|||
|
this.label1.Text = "Title";
|
|||
|
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|||
|
//
|
|||
|
// button1
|
|||
|
//
|
|||
|
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|||
|
this.button1.BackColor = System.Drawing.Color.Transparent;
|
|||
|
this.button1.DefaultImage = null;
|
|||
|
this.button1.DownImage = null;
|
|||
|
this.button1.IsSelected = false;
|
|||
|
this.button1.LabelText = "&Save";
|
|||
|
this.button1.Location = new System.Drawing.Point(241, 469);
|
|||
|
this.button1.Margin = new System.Windows.Forms.Padding(10);
|
|||
|
this.button1.Name = "button1";
|
|||
|
this.button1.OverImage = null;
|
|||
|
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
|
|||
|
this.button1.Size = new System.Drawing.Size(128, 32);
|
|||
|
this.button1.TabIndex = 173;
|
|||
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
|||
|
//
|
|||
|
// pickerBox1
|
|||
|
//
|
|||
|
this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|||
|
this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
|
|||
|
this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
|||
|
this.pickerBox1.Location = new System.Drawing.Point(285, 62);
|
|||
|
this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
|
|||
|
this.pickerBox1.Name = "pickerBox1";
|
|||
|
this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
|||
|
this.pickerBox1.Size = new System.Drawing.Size(84, 34);
|
|||
|
this.pickerBox1.SubmitButton = null;
|
|||
|
this.pickerBox1.TabIndex = 174;
|
|||
|
//
|
|||
|
// horizontalSeparator2
|
|||
|
//
|
|||
|
this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|||
|
this.horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
|||
|
this.horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
|||
|
this.horizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
|
|||
|
this.horizontalSeparator2.Location = new System.Drawing.Point(10, 437);
|
|||
|
this.horizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
|||
|
this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
|
|||
|
this.horizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
|
|||
|
this.horizontalSeparator2.Name = "horizontalSeparator2";
|
|||
|
this.horizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
|||
|
this.horizontalSeparator2.Size = new System.Drawing.Size(364, 22);
|
|||
|
this.horizontalSeparator2.TabIndex = 182;
|
|||
|
//
|
|||
|
// EditGroupForm
|
|||
|
//
|
|||
|
this.ClientSize = new System.Drawing.Size(384, 521);
|
|||
|
this.Controls.Add(this.horizontalSeparator2);
|
|||
|
this.Controls.Add(this.pickerBox1);
|
|||
|
this.Controls.Add(this.button1);
|
|||
|
this.Controls.Add(this.label2);
|
|||
|
this.Controls.Add(this.label1);
|
|||
|
this.Controls.Add(this.textBox1);
|
|||
|
this.MinimumSize = new System.Drawing.Size(400, 560);
|
|||
|
this.Name = "EditGroupForm";
|
|||
|
this.Text = "Edit Group";
|
|||
|
this.ResumeLayout(false);
|
|||
|
this.PerformLayout();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnShown(EventArgs e)
|
|||
|
{
|
|||
|
base.OnShown(e);
|
|||
|
|
|||
|
if (this.TilePanelLayout != null)
|
|||
|
{
|
|||
|
textBox1.Text = this.TilePanelLayout.Model.Title;
|
|||
|
pickerBox1.ComboBox.SelectedIndex = (this.TilePanelLayout.Model.IsExclusive ? 1 : 0);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public TilePanelLayout TilePanelLayout { get; set; } = null;
|
|||
|
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
TileGroupModel model = this.TilePanelLayout.Model;
|
|||
|
model.Title = textBox1.Text?.Trim();
|
|||
|
model.IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1);
|
|||
|
|
|||
|
this.TilePanelLayout.UpdateModel(model);
|
|||
|
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|