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 : TDialog { private ThButton button1; private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1; 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 ThYesNoPickerBox yesNoPickerBox3; private Label label4; private RyzStudio.Windows.ThemedForms.ButtonTextBox.ThClearableTextBox textBox1; private AppOptions _appSession = null; public OptionsForm(AppOptions appSession) { InitializeComponent(); _appSession = appSession; this.OkButton = button1; if (_appSession != null) { yesNoPickerBox1.Value = _appSession.RestorePosition; yesNoPickerBox2.Value = _appSession.AlwaysOnTop; textBox1.Text = _appSession.RunCommand ?? string.Empty; yesNoPickerBox3.Value = _appSession.IgnoreSSL; } } private void InitializeComponent() { button1 = new ThButton(); tHorizontalSeparator1 = new THorizontalSeparator(); 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(); yesNoPickerBox3 = new ThYesNoPickerBox(); label4 = new Label(); label3 = new Label(); flowLayoutPanel1.SuspendLayout(); panel1.SuspendLayout(); panel2.SuspendLayout(); panel3.SuspendLayout(); SuspendLayout(); // // button1 // button1.AcceptButton = null; button1.ActiveImage = null; button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; button1.BackColor = System.Drawing.Color.Transparent; button1.EnableMenuOnClick = false; button1.EnableReactiveVisual = true; button1.HoverImage = null; button1.IdleImage = null; button1.LabelText = "&Save"; button1.Location = new System.Drawing.Point(301, 469); button1.Margin = new Padding(10, 10, 10, 0); button1.Name = "button1"; button1.Padding = new Padding(4, 4, 3, 3); button1.Size = new System.Drawing.Size(128, 32); button1.TabIndex = 6; button1.TabStop = false; // // tHorizontalSeparator1 // tHorizontalSeparator1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; tHorizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0); tHorizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0); tHorizontalSeparator1.BackColor = System.Drawing.Color.Transparent; tHorizontalSeparator1.Location = new System.Drawing.Point(10, 437); tHorizontalSeparator1.Margin = new Padding(0, 10, 0, 0); tHorizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2); tHorizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22); tHorizontalSeparator1.Name = "tHorizontalSeparator1"; tHorizontalSeparator1.Size = new System.Drawing.Size(424, 22); tHorizontalSeparator1.TabIndex = 188; tHorizontalSeparator1.TabStop = false; // // 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 = 2; 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.AcceptButton = null; 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.Margin = new Padding(10, 10, 10, 0); yesNoPickerBox1.Name = "yesNoPickerBox1"; yesNoPickerBox1.Padding = new Padding(4, 4, 3, 3); 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 = 2; 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.AcceptButton = null; 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.Margin = new Padding(10, 10, 10, 0); yesNoPickerBox2.Name = "yesNoPickerBox2"; yesNoPickerBox2.Padding = new Padding(4, 4, 3, 3); yesNoPickerBox2.SelectedIndex = 1; yesNoPickerBox2.Size = new System.Drawing.Size(84, 34); yesNoPickerBox2.TabIndex = 198; yesNoPickerBox2.TabStop = false; yesNoPickerBox2.Value = true; // // thYesNoPickerBox1 // thYesNoPickerBox1.AcceptButton = null; 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.Margin = new Padding(10, 10, 10, 0); thYesNoPickerBox1.Name = "thYesNoPickerBox1"; thYesNoPickerBox1.Padding = new Padding(4, 4, 3, 3); 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(yesNoPickerBox3); panel3.Controls.Add(label4); 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 = 2; panel3.PaddingLeft = 4; panel3.Size = new System.Drawing.Size(401, 121); panel3.TabIndex = 1; panel3.Title = "Behaviour"; panel3.TitleContextMenuStrip = null; panel3.TitleCursor = Cursors.Default; // // textBox1 // textBox1.AcceptButton = null; 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.Margin = new Padding(10, 10, 10, 0); textBox1.Name = "textBox1"; textBox1.Padding = new Padding(4, 4, 3, 3); textBox1.Size = new System.Drawing.Size(230, 32); textBox1.TabIndex = 203; textBox1.TabStop = false; textBox1.UseSystemPasswordChar = false; // // yesNoPickerBox3 // yesNoPickerBox3.AcceptButton = null; yesNoPickerBox3.Anchor = AnchorStyles.Top | AnchorStyles.Right; yesNoPickerBox3.BackColor = System.Drawing.Color.Transparent; yesNoPickerBox3.EnableReactiveVisual = true; yesNoPickerBox3.Font = new System.Drawing.Font("Segoe UI", 9F); yesNoPickerBox3.Location = new System.Drawing.Point(307, 66); yesNoPickerBox3.Margin = new Padding(10, 10, 10, 0); yesNoPickerBox3.Name = "yesNoPickerBox3"; yesNoPickerBox3.Padding = new Padding(4, 4, 3, 3); yesNoPickerBox3.SelectedIndex = 1; yesNoPickerBox3.Size = new System.Drawing.Size(84, 34); yesNoPickerBox3.TabIndex = 202; yesNoPickerBox3.TabStop = false; yesNoPickerBox3.Value = true; // // label4 // label4.AutoSize = true; label4.BackColor = System.Drawing.Color.Transparent; label4.ForeColor = System.Drawing.SystemColors.ControlText; label4.Location = new System.Drawing.Point(1, 66); label4.Margin = new Padding(0); label4.Name = "label4"; label4.Padding = new Padding(0, 8, 0, 0); label4.Size = new System.Drawing.Size(95, 23); label4.TabIndex = 201; label4.Text = "Ignore SSL Errors"; label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // 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; // // OptionsForm // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new System.Drawing.Size(444, 521); Controls.Add(flowLayoutPanel1); Controls.Add(tHorizontalSeparator1); Controls.Add(button1); 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; _appSession.IgnoreSSL = yesNoPickerBox3.Value; return _appSession; } } } }