407 lines
18 KiB
C#
407 lines
18 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using RokettoLaunch.Models;
|
|
using RyzStudio.Windows.Forms;
|
|
using RyzStudio.Windows.ThemedForms;
|
|
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
|
|
using RyzStudio.Windows.ThemedForms.PickerBox;
|
|
|
|
namespace RokettoLaunch
|
|
{
|
|
public class OptionsForm : Form
|
|
{
|
|
private System.Windows.Forms.Label label1;
|
|
private ThYesNoPickerBox yesNoPickerBox2;
|
|
private System.Windows.Forms.Label label6;
|
|
private ThYesNoPickerBox yesNoPickerBox3;
|
|
private System.Windows.Forms.Label label7;
|
|
private ThKeyCodeTextBox textBox1;
|
|
private ThNumericBox numericBox1;
|
|
private Label label4;
|
|
private FlowLayoutPanel flowLayoutPanel1;
|
|
private TTogglePanel tTogglePanel1;
|
|
private TTogglePanel tTogglePanel2;
|
|
private ThYesNoPickerBox yesNoPickerBox1;
|
|
private Label label2;
|
|
private ThYesNoPickerBox yesNoPickerBox4;
|
|
private Label label3;
|
|
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
|
|
|
|
|
|
private AppOptions _appSession = null;
|
|
|
|
|
|
public OptionsForm(AppOptions appSession)
|
|
{
|
|
InitializeComponent();
|
|
|
|
UISetup.Dialog(this);
|
|
|
|
_appSession = appSession;
|
|
|
|
numericBox1.Minimum = 4;
|
|
numericBox1.Maximum = 24;
|
|
|
|
if (_appSession != null)
|
|
{
|
|
numericBox1.Value = _appSession.TilesPerRow;
|
|
yesNoPickerBox1.Value = _appSession.ShowBigIcons;
|
|
textBox1.UpdateKeyCode(_appSession?.ShowToggleHotkey ?? new ThKeyCodeTextBox.Results());
|
|
yesNoPickerBox2.Value = _appSession.HideOnClose;
|
|
yesNoPickerBox3.Value = _appSession.HideOnExecute;
|
|
yesNoPickerBox4.Value = _appSession.AlwaysOnTop;
|
|
}
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
ThKeyCodeTextBox.Results results1 = new ThKeyCodeTextBox.Results();
|
|
label1 = new Label();
|
|
yesNoPickerBox2 = new ThYesNoPickerBox();
|
|
label6 = new Label();
|
|
yesNoPickerBox3 = new ThYesNoPickerBox();
|
|
label7 = new Label();
|
|
textBox1 = new ThKeyCodeTextBox();
|
|
numericBox1 = new ThNumericBox();
|
|
label4 = new Label();
|
|
flowLayoutPanel1 = new FlowLayoutPanel();
|
|
tTogglePanel1 = new TTogglePanel();
|
|
yesNoPickerBox1 = new ThYesNoPickerBox();
|
|
label2 = new Label();
|
|
tTogglePanel2 = new TTogglePanel();
|
|
yesNoPickerBox4 = new ThYesNoPickerBox();
|
|
label3 = new Label();
|
|
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
|
flowLayoutPanel1.SuspendLayout();
|
|
tTogglePanel1.SuspendLayout();
|
|
tTogglePanel2.SuspendLayout();
|
|
SuspendLayout();
|
|
//
|
|
// 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(115, 23);
|
|
label1.TabIndex = 153;
|
|
label1.Text = "Show Toggle Hotkey";
|
|
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
//
|
|
// 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, 63);
|
|
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 = 183;
|
|
yesNoPickerBox2.TabStop = false;
|
|
yesNoPickerBox2.Value = true;
|
|
//
|
|
// label6
|
|
//
|
|
label6.AutoSize = true;
|
|
label6.BackColor = System.Drawing.Color.Transparent;
|
|
label6.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
label6.Location = new System.Drawing.Point(1, 63);
|
|
label6.Margin = new Padding(0);
|
|
label6.Name = "label6";
|
|
label6.Padding = new Padding(0, 8, 0, 0);
|
|
label6.Size = new System.Drawing.Size(83, 23);
|
|
label6.TabIndex = 182;
|
|
label6.Text = "Hide On Close";
|
|
label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
//
|
|
// 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, 107);
|
|
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 = 185;
|
|
yesNoPickerBox3.TabStop = false;
|
|
yesNoPickerBox3.Value = true;
|
|
//
|
|
// label7
|
|
//
|
|
label7.AutoSize = true;
|
|
label7.BackColor = System.Drawing.Color.Transparent;
|
|
label7.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
label7.Location = new System.Drawing.Point(1, 107);
|
|
label7.Margin = new Padding(0);
|
|
label7.Name = "label7";
|
|
label7.Padding = new Padding(0, 8, 0, 0);
|
|
label7.Size = new System.Drawing.Size(95, 23);
|
|
label7.TabIndex = 184;
|
|
label7.Text = "Hide On Execute";
|
|
label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
//
|
|
// textBox1
|
|
//
|
|
textBox1.AcceptButton = null;
|
|
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
textBox1.BackColor = System.Drawing.Color.Transparent;
|
|
textBox1.EnableReactiveVisual = true;
|
|
textBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
|
|
textBox1.Icon = "O";
|
|
textBox1.IconSize = 13F;
|
|
results1.IsAlt = false;
|
|
results1.IsCtrl = false;
|
|
results1.IsShift = false;
|
|
results1.Key = Keys.None;
|
|
textBox1.KeyCodeResults = results1;
|
|
textBox1.Location = new System.Drawing.Point(192, 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(199, 32);
|
|
textBox1.TabIndex = 189;
|
|
textBox1.TabStop = false;
|
|
textBox1.UseSystemPasswordChar = false;
|
|
//
|
|
// numericBox1
|
|
//
|
|
numericBox1.AcceptButton = null;
|
|
numericBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
numericBox1.BackColor = System.Drawing.Color.Transparent;
|
|
numericBox1.EnableReactiveVisual = true;
|
|
numericBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
|
|
numericBox1.Location = new System.Drawing.Point(252, 22);
|
|
numericBox1.Margin = new Padding(10, 10, 10, 0);
|
|
numericBox1.Maximum = 100;
|
|
numericBox1.Minimum = 1;
|
|
numericBox1.Name = "numericBox1";
|
|
numericBox1.Padding = new Padding(4, 4, 3, 3);
|
|
numericBox1.Size = new System.Drawing.Size(139, 32);
|
|
numericBox1.TabIndex = 192;
|
|
numericBox1.TabStop = false;
|
|
numericBox1.Value = 1;
|
|
//
|
|
// label4
|
|
//
|
|
label4.AutoSize = true;
|
|
label4.BackColor = System.Drawing.Color.Transparent;
|
|
label4.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
label4.Location = new System.Drawing.Point(1, 22);
|
|
label4.Margin = new Padding(0);
|
|
label4.Name = "label4";
|
|
label4.Padding = new Padding(0, 8, 0, 0);
|
|
label4.Size = new System.Drawing.Size(76, 23);
|
|
label4.TabIndex = 193;
|
|
label4.Text = "Tiles Per Row";
|
|
label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
//
|
|
// flowLayoutPanel1
|
|
//
|
|
flowLayoutPanel1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
flowLayoutPanel1.AutoScroll = true;
|
|
flowLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
|
|
flowLayoutPanel1.Controls.Add(tTogglePanel1);
|
|
flowLayoutPanel1.Controls.Add(tTogglePanel2);
|
|
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;
|
|
//
|
|
// tTogglePanel1
|
|
//
|
|
tTogglePanel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
|
tTogglePanel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
|
tTogglePanel1.Controls.Add(yesNoPickerBox1);
|
|
tTogglePanel1.Controls.Add(label2);
|
|
tTogglePanel1.Controls.Add(label4);
|
|
tTogglePanel1.Controls.Add(numericBox1);
|
|
tTogglePanel1.ExpandedHeight = 100;
|
|
tTogglePanel1.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
|
|
tTogglePanel1.IsOpen = true;
|
|
tTogglePanel1.Location = new System.Drawing.Point(0, 0);
|
|
tTogglePanel1.Margin = new Padding(0);
|
|
tTogglePanel1.Name = "tTogglePanel1";
|
|
tTogglePanel1.Padding = new Padding(0, 22, 0, 0);
|
|
tTogglePanel1.PaddingBottom = 0;
|
|
tTogglePanel1.PaddingLeft = 4;
|
|
tTogglePanel1.Size = new System.Drawing.Size(401, 119);
|
|
tTogglePanel1.TabIndex = 0;
|
|
tTogglePanel1.Title = "Appearance";
|
|
tTogglePanel1.TitleContextMenuStrip = null;
|
|
tTogglePanel1.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, 64);
|
|
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 = 195;
|
|
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, 64);
|
|
label2.Margin = new Padding(0);
|
|
label2.Name = "label2";
|
|
label2.Padding = new Padding(0, 8, 0, 0);
|
|
label2.Size = new System.Drawing.Size(87, 23);
|
|
label2.TabIndex = 194;
|
|
label2.Text = "Show Big Icons";
|
|
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
//
|
|
// tTogglePanel2
|
|
//
|
|
tTogglePanel2.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
|
tTogglePanel2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
|
tTogglePanel2.Controls.Add(yesNoPickerBox4);
|
|
tTogglePanel2.Controls.Add(label3);
|
|
tTogglePanel2.Controls.Add(label1);
|
|
tTogglePanel2.Controls.Add(textBox1);
|
|
tTogglePanel2.Controls.Add(yesNoPickerBox2);
|
|
tTogglePanel2.Controls.Add(yesNoPickerBox3);
|
|
tTogglePanel2.Controls.Add(label6);
|
|
tTogglePanel2.Controls.Add(label7);
|
|
tTogglePanel2.ExpandedHeight = 100;
|
|
tTogglePanel2.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
|
|
tTogglePanel2.IsOpen = true;
|
|
tTogglePanel2.Location = new System.Drawing.Point(0, 119);
|
|
tTogglePanel2.Margin = new Padding(0);
|
|
tTogglePanel2.Name = "tTogglePanel2";
|
|
tTogglePanel2.Padding = new Padding(0, 22, 0, 0);
|
|
tTogglePanel2.PaddingBottom = 0;
|
|
tTogglePanel2.PaddingLeft = 4;
|
|
tTogglePanel2.Size = new System.Drawing.Size(401, 206);
|
|
tTogglePanel2.TabIndex = 1;
|
|
tTogglePanel2.Title = "Behaviour";
|
|
tTogglePanel2.TitleContextMenuStrip = null;
|
|
tTogglePanel2.TitleCursor = Cursors.Default;
|
|
//
|
|
// yesNoPickerBox4
|
|
//
|
|
yesNoPickerBox4.AcceptButton = null;
|
|
yesNoPickerBox4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
yesNoPickerBox4.BackColor = System.Drawing.Color.Transparent;
|
|
yesNoPickerBox4.EnableReactiveVisual = true;
|
|
yesNoPickerBox4.Font = new System.Drawing.Font("Segoe UI", 9F);
|
|
yesNoPickerBox4.Location = new System.Drawing.Point(307, 151);
|
|
yesNoPickerBox4.Margin = new Padding(10, 10, 10, 0);
|
|
yesNoPickerBox4.Name = "yesNoPickerBox4";
|
|
yesNoPickerBox4.Padding = new Padding(4, 4, 3, 3);
|
|
yesNoPickerBox4.SelectedIndex = 1;
|
|
yesNoPickerBox4.Size = new System.Drawing.Size(84, 34);
|
|
yesNoPickerBox4.TabIndex = 191;
|
|
yesNoPickerBox4.TabStop = false;
|
|
yesNoPickerBox4.Value = true;
|
|
//
|
|
// label3
|
|
//
|
|
label3.AutoSize = true;
|
|
label3.BackColor = System.Drawing.Color.Transparent;
|
|
label3.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
label3.Location = new System.Drawing.Point(1, 151);
|
|
label3.Margin = new Padding(0);
|
|
label3.Name = "label3";
|
|
label3.Padding = new Padding(0, 8, 0, 0);
|
|
label3.Size = new System.Drawing.Size(85, 23);
|
|
label3.TabIndex = 190;
|
|
label3.Text = "Always On Top";
|
|
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);
|
|
tTogglePanel1.ResumeLayout(false);
|
|
tTogglePanel1.PerformLayout();
|
|
tTogglePanel2.ResumeLayout(false);
|
|
tTogglePanel2.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<Control>())
|
|
{
|
|
item.Width = width;
|
|
}
|
|
}
|
|
|
|
|
|
public AppOptions Result
|
|
{
|
|
get
|
|
{
|
|
if (_appSession == null)
|
|
{
|
|
_appSession = new AppOptions();
|
|
}
|
|
|
|
_appSession.TilesPerRow = numericBox1.Value;
|
|
_appSession.ShowBigIcons = yesNoPickerBox1.Value;
|
|
_appSession.ShowToggleHotkey = textBox1.KeyCodeResults;
|
|
_appSession.HideOnClose = yesNoPickerBox2.Value;
|
|
_appSession.HideOnExecute = yesNoPickerBox3.Value;
|
|
_appSession.AlwaysOnTop = yesNoPickerBox4.Value;
|
|
|
|
return _appSession;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |