using System; using System.Linq; using System.Windows.Forms; using FizzyLauncher.Models; using RyzStudio.Windows.Forms; using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms.PickerBox; namespace FizzyLauncher { public class OptionsForm : Form { private FlowLayoutPanel flowLayoutPanel1; private TTogglePanel panel1; private TTogglePanel panel3; private ThYesNoPickerBox yesNoPickerBox1; private Label label2; private TTogglePanel panel2; private ThYesNoPickerBox thYesNoPickerBox1; private Label label1; private ThYesNoPickerBox yesNoPickerBox2; private Label label3; private RyzStudio.Windows.ThemedForms.ButtonTextBox.ThClearableTextBox textBox1; private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1; private AppOptions _appSession = null; public OptionsForm(AppOptions appSession) { InitializeComponent(); UISetup.Dialog(this); _appSession = appSession; if (_appSession != null) { yesNoPickerBox1.Value = _appSession.RestorePosition; yesNoPickerBox2.Value = _appSession.AlwaysOnTop; textBox1.Text = _appSession.RunCommand ?? string.Empty; } } private void InitializeComponent() { flowLayoutPanel1 = new FlowLayoutPanel(); panel1 = new TTogglePanel(); yesNoPickerBox1 = new ThYesNoPickerBox(); label2 = new Label(); panel2 = new TTogglePanel(); yesNoPickerBox2 = new ThYesNoPickerBox(); thYesNoPickerBox1 = new ThYesNoPickerBox(); label1 = new Label(); panel3 = new TTogglePanel(); textBox1 = new RyzStudio.Windows.ThemedForms.ButtonTextBox.ThClearableTextBox(); label3 = new Label(); dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter(); flowLayoutPanel1.SuspendLayout(); panel1.SuspendLayout(); panel2.SuspendLayout(); panel3.SuspendLayout(); SuspendLayout(); // // flowLayoutPanel1 // flowLayoutPanel1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; flowLayoutPanel1.AutoScroll = true; flowLayoutPanel1.BackColor = System.Drawing.Color.Transparent; flowLayoutPanel1.Controls.Add(panel1); flowLayoutPanel1.Controls.Add(panel2); flowLayoutPanel1.Controls.Add(panel3); flowLayoutPanel1.FlowDirection = FlowDirection.TopDown; flowLayoutPanel1.Location = new System.Drawing.Point(8, 12); flowLayoutPanel1.Name = "flowLayoutPanel1"; flowLayoutPanel1.Size = new System.Drawing.Size(436, 412); flowLayoutPanel1.TabIndex = 194; flowLayoutPanel1.WrapContents = false; flowLayoutPanel1.Resize += flowLayoutPanel1_Resize; // // panel1 // panel1.AutoScrollMargin = new System.Drawing.Size(0, 0); panel1.AutoScrollMinSize = new System.Drawing.Size(0, 0); panel1.Controls.Add(yesNoPickerBox1); panel1.Controls.Add(label2); panel1.ExpandedHeight = 100; panel1.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119); panel1.IsOpen = true; panel1.Location = new System.Drawing.Point(0, 0); panel1.Margin = new Padding(0); panel1.Name = "panel1"; panel1.PaddingBottom = 0; panel1.PaddingLeft = 4; panel1.Size = new System.Drawing.Size(401, 77); panel1.TabIndex = 0; panel1.Title = "On Start-Up"; panel1.TitleContextMenuStrip = null; panel1.TitleCursor = Cursors.Default; // // yesNoPickerBox1 // yesNoPickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right; yesNoPickerBox1.BackColor = System.Drawing.Color.Transparent; yesNoPickerBox1.EnableReactiveVisual = true; yesNoPickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F); yesNoPickerBox1.Location = new System.Drawing.Point(307, 22); yesNoPickerBox1.Name = "yesNoPickerBox1"; yesNoPickerBox1.SelectedIndex = 1; yesNoPickerBox1.Size = new System.Drawing.Size(84, 34); yesNoPickerBox1.TabIndex = 197; yesNoPickerBox1.TabStop = false; yesNoPickerBox1.Value = true; // // label2 // label2.AutoSize = true; label2.BackColor = System.Drawing.Color.Transparent; label2.ForeColor = System.Drawing.SystemColors.ControlText; label2.Location = new System.Drawing.Point(1, 22); label2.Margin = new Padding(0); label2.Name = "label2"; label2.Padding = new Padding(0, 8, 0, 0); label2.Size = new System.Drawing.Size(92, 23); label2.TabIndex = 196; label2.Text = "Restore Position"; label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // panel2 // panel2.AutoScrollMargin = new System.Drawing.Size(0, 0); panel2.AutoScrollMinSize = new System.Drawing.Size(0, 0); panel2.Controls.Add(yesNoPickerBox2); panel2.Controls.Add(thYesNoPickerBox1); panel2.Controls.Add(label1); panel2.ExpandedHeight = 100; panel2.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119); panel2.IsOpen = true; panel2.Location = new System.Drawing.Point(0, 77); panel2.Margin = new Padding(0); panel2.Name = "panel2"; panel2.PaddingBottom = 0; panel2.PaddingLeft = 4; panel2.Size = new System.Drawing.Size(401, 77); panel2.TabIndex = 2; panel2.Title = "Appearance"; panel2.TitleContextMenuStrip = null; panel2.TitleCursor = Cursors.Default; // // yesNoPickerBox2 // yesNoPickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right; yesNoPickerBox2.BackColor = System.Drawing.Color.Transparent; yesNoPickerBox2.EnableReactiveVisual = true; yesNoPickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F); yesNoPickerBox2.Location = new System.Drawing.Point(307, 22); yesNoPickerBox2.Name = "yesNoPickerBox2"; yesNoPickerBox2.SelectedIndex = 1; yesNoPickerBox2.Size = new System.Drawing.Size(84, 34); yesNoPickerBox2.TabIndex = 198; yesNoPickerBox2.TabStop = false; yesNoPickerBox2.Value = true; // // thYesNoPickerBox1 // thYesNoPickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right; thYesNoPickerBox1.BackColor = System.Drawing.Color.Transparent; thYesNoPickerBox1.EnableReactiveVisual = true; thYesNoPickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F); thYesNoPickerBox1.Location = new System.Drawing.Point(508, 22); thYesNoPickerBox1.Name = "thYesNoPickerBox1"; thYesNoPickerBox1.SelectedIndex = 1; thYesNoPickerBox1.Size = new System.Drawing.Size(84, 34); thYesNoPickerBox1.TabIndex = 197; thYesNoPickerBox1.TabStop = false; thYesNoPickerBox1.Value = true; // // label1 // label1.AutoSize = true; label1.BackColor = System.Drawing.Color.Transparent; label1.ForeColor = System.Drawing.SystemColors.ControlText; label1.Location = new System.Drawing.Point(1, 22); label1.Margin = new Padding(0); label1.Name = "label1"; label1.Padding = new Padding(0, 8, 0, 0); label1.Size = new System.Drawing.Size(85, 23); label1.TabIndex = 196; label1.Text = "Always On Top"; label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // panel3 // panel3.AutoScrollMargin = new System.Drawing.Size(0, 0); panel3.AutoScrollMinSize = new System.Drawing.Size(0, 0); panel3.Controls.Add(textBox1); panel3.Controls.Add(label3); panel3.ExpandedHeight = 100; panel3.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119); panel3.IsOpen = true; panel3.Location = new System.Drawing.Point(0, 154); panel3.Margin = new Padding(0); panel3.Name = "panel3"; panel3.PaddingBottom = 0; panel3.PaddingLeft = 4; panel3.Size = new System.Drawing.Size(401, 77); panel3.TabIndex = 1; panel3.Title = "Behaviour"; panel3.TitleContextMenuStrip = null; panel3.TitleCursor = Cursors.Default; // // textBox1 // textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBox1.BackColor = System.Drawing.Color.Transparent; textBox1.ClearedValue = "{0}"; textBox1.EnableReactiveVisual = true; textBox1.Font = new System.Drawing.Font("Segoe UI", 9F); textBox1.Icon = "O"; textBox1.IconSize = 13F; textBox1.Location = new System.Drawing.Point(161, 21); textBox1.Name = "textBox1"; textBox1.Size = new System.Drawing.Size(230, 32); textBox1.TabIndex = 203; textBox1.TabStop = false; textBox1.UseSystemPasswordChar = false; // // label3 // label3.AutoSize = true; label3.BackColor = System.Drawing.Color.Transparent; label3.ForeColor = System.Drawing.SystemColors.ControlText; label3.Location = new System.Drawing.Point(1, 21); label3.Margin = new Padding(0); label3.Name = "label3"; label3.Padding = new Padding(0, 8, 0, 0); label3.Size = new System.Drawing.Size(88, 23); label3.TabIndex = 199; label3.Text = "Run Command"; label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // 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(444, 84); // // OptionsForm // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; BackColor = System.Drawing.Color.White; ClientSize = new System.Drawing.Size(444, 521); Controls.Add(dialogFooter1); Controls.Add(flowLayoutPanel1); MinimumSize = new System.Drawing.Size(460, 560); Name = "OptionsForm"; Text = "Options"; flowLayoutPanel1.ResumeLayout(false); panel1.ResumeLayout(false); panel1.PerformLayout(); panel2.ResumeLayout(false); panel2.PerformLayout(); panel3.ResumeLayout(false); panel3.PerformLayout(); ResumeLayout(false); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); flowLayoutPanel1_Resize(null, e); } private void flowLayoutPanel1_Resize(object sender, EventArgs e) { var width = flowLayoutPanel1.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth; foreach (var item in flowLayoutPanel1.Controls.OfType()) { item.Width = width; } } public AppOptions Result { get { if (_appSession == null) { _appSession = new AppOptions(); } _appSession.RestorePosition = yesNoPickerBox1.Value; _appSession.AlwaysOnTop = yesNoPickerBox2.Value; _appSession.RunCommand = textBox1.Text ?? string.Empty; return _appSession; } } } }