roketto-launch/EditGroupForm.cs

155 lines
5.6 KiB
C#
Raw Permalink Normal View History

2024-08-06 20:27:08 +00:00
using System.Windows.Forms;
using RokettoLaunch.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
using RyzStudio.Windows.ThemedForms.PickerBox;
namespace RokettoLaunch
{
public class EditGroupForm : Form
{
private Label label2;
private Label label1;
private ThYesNoPickerBox pickerBox1;
private ThClearableTextBox textBox1;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private TileGroupModel result = null;
public EditGroupForm(TileGroupModel model = null)
{
InitializeComponent();
UISetup.Dialog(this);
this.Text = (result == null) ? "Add Group" : "Edit Group";
result = model;
pickerBox1.ComboBox.Items.Clear();
pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
if (pickerBox1.ComboBox.Items.Count > 0)
{
pickerBox1.ComboBox.SelectedIndex = 0;
}
if (result != null)
{
textBox1.Text = result.Title?.Trim() ?? string.Empty;
pickerBox1.Value = result.IsExpanded;
}
}
private void InitializeComponent()
{
textBox1 = new ThClearableTextBox();
label2 = new Label();
label1 = new Label();
pickerBox1 = new ThYesNoPickerBox();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
SuspendLayout();
//
// textBox1
//
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = System.Drawing.Color.Transparent;
textBox1.ClearedValue = "";
textBox1.EnableReactiveVisual = true;
textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
textBox1.Icon = "O";
textBox1.IconSize = 13F;
textBox1.Location = new System.Drawing.Point(192, 20);
textBox1.Name = "textBox1";
textBox1.Size = new System.Drawing.Size(177, 32);
textBox1.TabIndex = 152;
textBox1.TabStop = false;
textBox1.UseSystemPasswordChar = false;
//
// label2
//
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent;
label2.ForeColor = System.Drawing.SystemColors.ControlText;
label2.Location = new System.Drawing.Point(10, 62);
label2.Margin = new Padding(0);
label2.Name = "label2";
label2.Padding = new Padding(0, 9, 0, 0);
label2.Size = new System.Drawing.Size(91, 24);
label2.TabIndex = 155;
label2.Text = "Show Expanded";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label1
//
label1.AutoSize = true;
label1.BackColor = System.Drawing.Color.Transparent;
label1.ForeColor = System.Drawing.SystemColors.ControlText;
label1.Location = new System.Drawing.Point(10, 20);
label1.Margin = new Padding(0);
label1.Name = "label1";
label1.Padding = new Padding(0, 9, 0, 0);
label1.Size = new System.Drawing.Size(29, 24);
label1.TabIndex = 153;
label1.Text = "Title";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox1
//
pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox1.BackColor = System.Drawing.Color.Transparent;
pickerBox1.EnableReactiveVisual = true;
pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
pickerBox1.Location = new System.Drawing.Point(285, 62);
pickerBox1.Name = "pickerBox1";
pickerBox1.SelectedIndex = 0;
pickerBox1.Size = new System.Drawing.Size(84, 34);
pickerBox1.TabIndex = 174;
pickerBox1.TabStop = false;
pickerBox1.Value = false;
//
// dialogFooter1
//
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
dialogFooter1.Button1Text = "&Save";
dialogFooter1.Dialog = this;
dialogFooter1.Dock = DockStyle.Bottom;
dialogFooter1.Location = new System.Drawing.Point(0, 437);
dialogFooter1.Name = "dialogFooter1";
dialogFooter1.Size = new System.Drawing.Size(384, 84);
//
// EditGroupForm
//
BackColor = System.Drawing.Color.White;
ClientSize = new System.Drawing.Size(384, 521);
Controls.Add(dialogFooter1);
Controls.Add(pickerBox1);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(textBox1);
MinimumSize = new System.Drawing.Size(400, 560);
Name = "EditGroupForm";
Text = "Edit Group";
ResumeLayout(false);
PerformLayout();
}
public TileGroupModel Result
{
get
{
if (result == null)
{
result = new TileGroupModel();
}
result.Title = textBox1.Text?.Trim() ?? string.Empty;
result.IsExpanded = pickerBox1.Value;
return result;
}
}
}
}