using AppLauncher.Models; using RyzStudio.Windows.ThemedForms; using System; using System.Drawing; using System.Text; namespace AppLauncher.Windows.Forms { public class OptionsForm : TDialogForm { private System.Windows.Forms.Label label1; private TButton button1; private TTextBox textBox1; private TYesNoPickerBox pickerBox1; private System.Windows.Forms.Label label2; private TYesNoPickerBox pickerBox2; private System.Windows.Forms.Label label3; private TYesNoPickerBox pickerBox3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private TYesNoPickerBox pickerBox4; private System.Windows.Forms.Label label6; private TYesNoPickerBox pickerBox5; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private TPickerBox pickerBox6; public MainForm parentForm { get; set; } = null; protected LauncherSession.HotKeyOptions hotKeyOptions = null; public OptionsForm(MainForm parent) : base() { InitializeComponent(); parentForm = parent; textBox1.InnerTextBox.ReadOnly = true; textBox1.InnerTextBox.BackColor = Color.White; textBox1.InnerTextBox.KeyUp += textBox1_KeyUp; pickerBox6.ComboBox.Items.Clear(); foreach (string item in Enum.GetNames(typeof(LauncherSession.AutoSaveOption))) { pickerBox6.ComboBox.Items.Add(item); } if (pickerBox6.ComboBox.Items.Count > 0) pickerBox6.ComboBox.SelectedIndex = 0; } private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm)); this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox(); this.label2 = new System.Windows.Forms.Label(); this.pickerBox2 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox(); this.label3 = new System.Windows.Forms.Label(); this.pickerBox3 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.pickerBox4 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox(); this.label6 = new System.Windows.Forms.Label(); this.pickerBox5 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.pickerBox6 = new RyzStudio.Windows.ThemedForms.TPickerBox(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); this.SuspendLayout(); // // imgbxClose // this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image"))); this.imgbxClose.Location = new System.Drawing.Point(367, 5); // // panel1 // this.panel1.Location = new System.Drawing.Point(394, 474); // // area1 // this.area1.Location = new System.Drawing.Point(1, 474); this.area1.Size = new System.Drawing.Size(392, 5); // // 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); this.textBox1.Location = new System.Drawing.Point(159, 206); 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(220, 32); this.textBox1.SubmitButton = null; this.textBox1.TabIndex = 152; this.textBox1.UseSystemPasswordChar = false; // // label1 // this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label1.Location = new System.Drawing.Point(18, 83); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(131, 32); this.label1.TabIndex = 153; this.label1.Text = "Use Control"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | 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(251, 427); 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.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox1.BackColor = System.Drawing.Color.Transparent; this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.pickerBox1.Location = new System.Drawing.Point(159, 83); this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4); this.pickerBox1.Name = "pickerBox1"; this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); this.pickerBox1.Size = new System.Drawing.Size(220, 32); this.pickerBox1.SubmitButton = null; this.pickerBox1.TabIndex = 174; this.pickerBox1.Value = false; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.Black; this.label2.Location = new System.Drawing.Point(8, 50); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(131, 24); this.label2.TabIndex = 175; this.label2.Text = "Hotkey"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // pickerBox2 // this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox2.BackColor = System.Drawing.Color.Transparent; this.pickerBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.pickerBox2.Location = new System.Drawing.Point(159, 124); this.pickerBox2.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4); this.pickerBox2.Name = "pickerBox2"; this.pickerBox2.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); this.pickerBox2.Size = new System.Drawing.Size(220, 32); this.pickerBox2.SubmitButton = null; this.pickerBox2.TabIndex = 177; this.pickerBox2.Value = false; // // label3 // this.label3.BackColor = System.Drawing.Color.Transparent; this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label3.Location = new System.Drawing.Point(18, 124); this.label3.Margin = new System.Windows.Forms.Padding(0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(131, 32); this.label3.TabIndex = 176; this.label3.Text = "Use Alt"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // pickerBox3 // this.pickerBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox3.BackColor = System.Drawing.Color.Transparent; this.pickerBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.pickerBox3.Location = new System.Drawing.Point(159, 165); this.pickerBox3.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4); this.pickerBox3.Name = "pickerBox3"; this.pickerBox3.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); this.pickerBox3.Size = new System.Drawing.Size(220, 32); this.pickerBox3.SubmitButton = null; this.pickerBox3.TabIndex = 179; this.pickerBox3.Value = false; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label4.Location = new System.Drawing.Point(18, 165); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(131, 32); this.label4.TabIndex = 178; this.label4.Text = "Use Shift"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label5 // this.label5.BackColor = System.Drawing.Color.Transparent; this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label5.Location = new System.Drawing.Point(18, 206); this.label5.Margin = new System.Windows.Forms.Padding(0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(131, 32); this.label5.TabIndex = 180; this.label5.Text = "Key"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // horizontalSeparator2 // this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.horizontalSeparator2.Location = new System.Drawing.Point(10, 247); this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2); this.horizontalSeparator2.Name = "horizontalSeparator2"; this.horizontalSeparator2.Size = new System.Drawing.Size(380, 2); this.horizontalSeparator2.TabIndex = 181; // // pickerBox4 // this.pickerBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox4.BackColor = System.Drawing.Color.Transparent; this.pickerBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.pickerBox4.Location = new System.Drawing.Point(159, 300); this.pickerBox4.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4); this.pickerBox4.Name = "pickerBox4"; this.pickerBox4.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); this.pickerBox4.Size = new System.Drawing.Size(220, 32); this.pickerBox4.SubmitButton = null; this.pickerBox4.TabIndex = 183; this.pickerBox4.Value = true; // // label6 // this.label6.BackColor = System.Drawing.Color.Transparent; this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label6.Location = new System.Drawing.Point(18, 300); this.label6.Margin = new System.Windows.Forms.Padding(0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(131, 32); this.label6.TabIndex = 182; this.label6.Text = "Hide On Close"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // pickerBox5 // this.pickerBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox5.BackColor = System.Drawing.Color.Transparent; this.pickerBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.pickerBox5.Location = new System.Drawing.Point(159, 341); this.pickerBox5.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4); this.pickerBox5.Name = "pickerBox5"; this.pickerBox5.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); this.pickerBox5.Size = new System.Drawing.Size(220, 32); this.pickerBox5.SubmitButton = null; this.pickerBox5.TabIndex = 185; this.pickerBox5.Value = true; // // label7 // this.label7.BackColor = System.Drawing.Color.Transparent; this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label7.Location = new System.Drawing.Point(18, 341); this.label7.Margin = new System.Windows.Forms.Padding(0); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(131, 32); this.label7.TabIndex = 184; this.label7.Text = "Hide On Click"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label8 // this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label8.Location = new System.Drawing.Point(18, 259); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(131, 32); this.label8.TabIndex = 186; this.label8.Text = "Auto Save"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // pickerBox6 // this.pickerBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pickerBox6.BackColor = System.Drawing.Color.Transparent; this.pickerBox6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.pickerBox6.Location = new System.Drawing.Point(159, 259); this.pickerBox6.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4); this.pickerBox6.Name = "pickerBox6"; this.pickerBox6.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); this.pickerBox6.Size = new System.Drawing.Size(220, 32); this.pickerBox6.SubmitButton = null; this.pickerBox6.TabIndex = 187; // // OptionsForm // this.ClientSize = new System.Drawing.Size(400, 480); this.Controls.Add(this.pickerBox6); this.Controls.Add(this.label8); this.Controls.Add(this.pickerBox5); this.Controls.Add(this.label7); this.Controls.Add(this.pickerBox4); this.Controls.Add(this.label6); this.Controls.Add(this.horizontalSeparator2); this.Controls.Add(this.label5); this.Controls.Add(this.pickerBox3); this.Controls.Add(this.label4); this.Controls.Add(this.pickerBox2); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.pickerBox1); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.textBox1); this.Name = "OptionsForm"; this.Title = "Options"; this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.area1, 0); this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.label1, 0); this.Controls.SetChildIndex(this.button1, 0); this.Controls.SetChildIndex(this.pickerBox1, 0); this.Controls.SetChildIndex(this.label2, 0); this.Controls.SetChildIndex(this.label3, 0); this.Controls.SetChildIndex(this.pickerBox2, 0); this.Controls.SetChildIndex(this.label4, 0); this.Controls.SetChildIndex(this.pickerBox3, 0); this.Controls.SetChildIndex(this.label5, 0); this.Controls.SetChildIndex(this.horizontalSeparator2, 0); this.Controls.SetChildIndex(this.label6, 0); this.Controls.SetChildIndex(this.pickerBox4, 0); this.Controls.SetChildIndex(this.label7, 0); this.Controls.SetChildIndex(this.pickerBox5, 0); this.Controls.SetChildIndex(this.label8, 0); this.Controls.SetChildIndex(this.pickerBox6, 0); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); this.ResumeLayout(false); } protected override void OnShown(EventArgs e) { base.OnShown(e); if (hotKeyOptions == null) hotKeyOptions = new LauncherSession.HotKeyOptions(); if (parentForm == null) { return; } if (parentForm.CurrentSession == null) { return; } // hotkey if (parentForm.CurrentSession.HotKey != null) { hotKeyOptions.IsCtrl = parentForm.CurrentSession.HotKey.IsCtrl; hotKeyOptions.IsAlt = parentForm.CurrentSession.HotKey.IsAlt; hotKeyOptions.IsShift = parentForm.CurrentSession.HotKey.IsShift; hotKeyOptions.Key = parentForm.CurrentSession.HotKey.Key; pickerBox1.Value = hotKeyOptions.IsCtrl; pickerBox2.Value = hotKeyOptions.IsAlt; pickerBox3.Value = hotKeyOptions.IsShift; textBox1.Text = hotKeyOptions.KeyCode.ToString(); } pickerBox4.Value = parentForm.CurrentSession.HideOnClose; pickerBox5.Value = parentForm.CurrentSession.HideOnClick; pickerBox6.ComboBox.SelectedIndex = (int)parentForm.CurrentSession.AutoSave; } private void button1_Click(object sender, EventArgs e) { if (hotKeyOptions == null) hotKeyOptions = new LauncherSession.HotKeyOptions(); if (parentForm != null) { if (parentForm.CurrentSession == null) parentForm.CurrentSession = new LauncherSession(); if (parentForm.CurrentSession.HotKey == null) parentForm.CurrentSession.HotKey = new LauncherSession.HotKeyOptions(); parentForm.CurrentSession.HotKey.IsCtrl = pickerBox1.Value; parentForm.CurrentSession.HotKey.IsAlt = pickerBox2.Value; parentForm.CurrentSession.HotKey.IsShift = pickerBox3.Value; parentForm.CurrentSession.HotKey.Key = hotKeyOptions.Key; parentForm.CurrentSession.HideOnClose = pickerBox4.Value; parentForm.CurrentSession.HideOnClick = pickerBox5.Value; parentForm.CurrentSession.AutoSave = (LauncherSession.AutoSaveOption)pickerBox6.ComboBox.SelectedIndex; } this.Close(); } private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.ControlKey) return; if (e.KeyCode == System.Windows.Forms.Keys.ShiftKey) return; if (e.KeyCode == System.Windows.Forms.Keys.Menu) return; if (hotKeyOptions == null) hotKeyOptions = new LauncherSession.HotKeyOptions(); //hotKeyOptions.IsCtrl = pickerBox1.Value; //hotKeyOptions.IsAlt = pickerBox2.Value; //hotKeyOptions.IsShift = pickerBox3.Value; hotKeyOptions.Key = (int)e.KeyCode; //StringBuilder sb = new StringBuilder(); //if (hotKeyOptions.IsCtrl) sb = sb.Append("Ctrl + "); //if (hotKeyOptions.IsAlt) sb = sb.Append("Alt + "); //if (hotKeyOptions.IsShift) sb = sb.Append("Shift + "); //sb = sb.Append(e.KeyCode.ToString()); //textBox1.Text = sb.ToString(); textBox1.Text = e.KeyCode.ToString(); } } }