random-file-runner/OptionsForm.cs

308 lines
14 KiB
C#
Raw Normal View History

2021-10-24 15:49:48 +00:00
using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
using RyzStudio.Windows.ThemedForms.PickerBox;
2021-10-24 15:49:48 +00:00
using System;
using System.Windows.Forms;
namespace RandomFileRunner
{
public class OptionsForm : Form
2021-10-24 15:49:48 +00:00
{
private ThButton button1;
private ThYesNoPickerBox pickerBox1;
2021-10-24 15:49:48 +00:00
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
private ThNumericPickerBox pickerBox2;
private ThKeyCodeTextBox textBox1;
private ThYesNoPickerBox pickerBox3;
2021-10-30 02:21:45 +00:00
private Label label1;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator3;
private Label label2;
2021-10-24 15:49:48 +00:00
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
public OptionsForm(AppSession session) : base()
{
InitializeComponent();
this.Session = session;
}
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm));
ThKeyCodeTextBox.Results results1 = new ThKeyCodeTextBox.Results();
button1 = new ThButton();
pickerBox1 = new ThYesNoPickerBox();
label6 = new Label();
label8 = new Label();
tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
tHorizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
pickerBox2 = new ThNumericPickerBox();
textBox1 = new ThKeyCodeTextBox();
pickerBox3 = new ThYesNoPickerBox();
label1 = new Label();
tHorizontalSeparator3 = new RyzStudio.Windows.Forms.THorizontalSeparator();
label2 = new Label();
SuspendLayout();
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// button1
2021-12-29 19:14:00 +00:00
//
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(241, 469);
button1.Margin = new Padding(10, 0, 10, 10);
button1.Name = "button1";
button1.Padding = new Padding(4, 4, 3, 3);
button1.Size = new System.Drawing.Size(128, 32);
button1.TabIndex = 4;
button1.TabStop = false;
button1.MouseClick += button1_MouseClick;
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// pickerBox1
2021-12-29 19:14:00 +00:00
//
pickerBox1.AcceptButton = null;
pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox1.BackColor = System.Drawing.Color.Transparent;
pickerBox1.EnableReactiveVisual = true;
pickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
pickerBox1.Location = new System.Drawing.Point(285, 21);
pickerBox1.Margin = new Padding(10, 10, 10, 0);
pickerBox1.Name = "pickerBox1";
pickerBox1.Padding = new Padding(4, 4, 3, 3);
pickerBox1.SelectedIndex = 1;
pickerBox1.Size = new System.Drawing.Size(84, 35);
pickerBox1.TabIndex = 0;
pickerBox1.TabStop = false;
pickerBox1.Value = true;
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// label6
2021-12-29 19:14:00 +00:00
//
label6.AutoSize = true;
label6.BackColor = System.Drawing.Color.Transparent;
label6.ForeColor = System.Drawing.SystemColors.ControlText;
label6.Location = new System.Drawing.Point(10, 85);
label6.Margin = new Padding(0);
label6.Name = "label6";
label6.Padding = new Padding(0, 9, 0, 10);
label6.Size = new System.Drawing.Size(81, 34);
label6.TabIndex = 182;
label6.Text = "Retry On Error";
label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// label8
2021-12-29 19:14:00 +00:00
//
label8.AutoSize = true;
label8.BackColor = System.Drawing.Color.Transparent;
label8.ForeColor = System.Drawing.SystemColors.ControlText;
label8.Location = new System.Drawing.Point(10, 21);
label8.Margin = new Padding(0);
label8.Name = "label8";
label8.Padding = new Padding(0, 9, 0, 10);
label8.Size = new System.Drawing.Size(143, 34);
label8.TabIndex = 186;
label8.Text = "Search Top Directory Only";
label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// tHorizontalSeparator1
2021-12-29 19:14:00 +00:00
//
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(364, 22);
tHorizontalSeparator1.TabIndex = 188;
tHorizontalSeparator1.TabStop = false;
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// tHorizontalSeparator2
2021-12-29 19:14:00 +00:00
//
tHorizontalSeparator2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tHorizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
tHorizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
tHorizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
tHorizontalSeparator2.Location = new System.Drawing.Point(10, 59);
tHorizontalSeparator2.Margin = new Padding(0, 10, 0, 0);
tHorizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
tHorizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
tHorizontalSeparator2.Name = "tHorizontalSeparator2";
tHorizontalSeparator2.Size = new System.Drawing.Size(364, 22);
tHorizontalSeparator2.TabIndex = 190;
tHorizontalSeparator2.TabStop = false;
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// pickerBox2
2021-12-29 19:14:00 +00:00
//
pickerBox2.AcceptButton = null;
pickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox2.BackColor = System.Drawing.Color.Transparent;
pickerBox2.EnableReactiveVisual = true;
pickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F);
pickerBox2.Location = new System.Drawing.Point(285, 85);
pickerBox2.Margin = new Padding(10, 10, 10, 0);
pickerBox2.MaxDropDownItems = 10;
pickerBox2.Maximum = 50;
pickerBox2.Minimum = 0;
pickerBox2.Name = "pickerBox2";
pickerBox2.Padding = new Padding(4, 4, 3, 3);
pickerBox2.SelectedIndex = 0;
pickerBox2.Size = new System.Drawing.Size(84, 35);
pickerBox2.TabIndex = 1;
pickerBox2.TabStop = false;
pickerBox2.Value = 0;
2021-12-29 19:14:00 +00:00
//
2021-10-30 02:21:45 +00:00
// textBox1
2021-12-29 19:14:00 +00:00
//
textBox1.AcceptButton = null;
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
textBox1.BackColor = System.Drawing.Color.Transparent;
textBox1.EnableReactiveVisual = true;
textBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
textBox1.HighlightImage = (System.Drawing.Image)resources.GetObject("textBox1.HighlightImage");
2021-10-30 02:21:45 +00:00
results1.IsAlt = false;
results1.IsCtrl = false;
results1.IsShift = false;
results1.Key = Keys.None;
textBox1.KeyCodeResults = results1;
textBox1.Location = new System.Drawing.Point(241, 197);
textBox1.Margin = new Padding(10, 10, 10, 0);
textBox1.Name = "textBox1";
textBox1.NormalImage = (System.Drawing.Image)resources.GetObject("textBox1.NormalImage");
textBox1.Padding = new Padding(4, 4, 3, 3);
textBox1.Size = new System.Drawing.Size(128, 32);
textBox1.TabIndex = 3;
textBox1.TabStop = false;
textBox1.UseSystemPasswordChar = false;
2021-12-29 19:14:00 +00:00
//
2021-10-30 02:21:45 +00:00
// pickerBox3
2021-12-29 19:14:00 +00:00
//
pickerBox3.AcceptButton = null;
pickerBox3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox3.BackColor = System.Drawing.Color.Transparent;
pickerBox3.EnableReactiveVisual = true;
pickerBox3.Font = new System.Drawing.Font("Segoe UI", 9F);
pickerBox3.Location = new System.Drawing.Point(285, 127);
pickerBox3.Margin = new Padding(10, 10, 10, 0);
pickerBox3.Name = "pickerBox3";
pickerBox3.Padding = new Padding(4, 4, 3, 3);
pickerBox3.SelectedIndex = 1;
pickerBox3.Size = new System.Drawing.Size(84, 35);
pickerBox3.TabIndex = 2;
pickerBox3.TabStop = false;
pickerBox3.Value = true;
2021-12-29 19:14:00 +00:00
//
2021-10-30 02:21:45 +00:00
// label1
2021-12-29 19:14:00 +00:00
//
label1.AutoSize = true;
label1.BackColor = System.Drawing.Color.Transparent;
label1.ForeColor = System.Drawing.SystemColors.ControlText;
label1.Location = new System.Drawing.Point(10, 127);
label1.Margin = new Padding(0);
label1.Name = "label1";
label1.Padding = new Padding(0, 9, 0, 10);
label1.Size = new System.Drawing.Size(169, 34);
label1.TabIndex = 196;
label1.Text = "Close Current Process On Next";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
2021-12-29 19:14:00 +00:00
//
2021-10-30 02:21:45 +00:00
// tHorizontalSeparator3
2021-12-29 19:14:00 +00:00
//
tHorizontalSeparator3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tHorizontalSeparator3.AutoScrollMargin = new System.Drawing.Size(0, 0);
tHorizontalSeparator3.AutoScrollMinSize = new System.Drawing.Size(0, 0);
tHorizontalSeparator3.BackColor = System.Drawing.Color.Transparent;
tHorizontalSeparator3.Location = new System.Drawing.Point(10, 165);
tHorizontalSeparator3.Margin = new Padding(0, 10, 0, 0);
tHorizontalSeparator3.MaximumSize = new System.Drawing.Size(4920, 2);
tHorizontalSeparator3.MinimumSize = new System.Drawing.Size(0, 22);
tHorizontalSeparator3.Name = "tHorizontalSeparator3";
tHorizontalSeparator3.Size = new System.Drawing.Size(364, 22);
tHorizontalSeparator3.TabIndex = 197;
tHorizontalSeparator3.TabStop = false;
2021-12-29 19:14:00 +00:00
//
2021-10-30 02:21:45 +00:00
// label2
2021-12-29 19:14:00 +00:00
//
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent;
label2.ForeColor = System.Drawing.SystemColors.ControlText;
label2.Location = new System.Drawing.Point(10, 197);
label2.Margin = new Padding(0);
label2.Name = "label2";
label2.Padding = new Padding(0, 9, 0, 10);
label2.Size = new System.Drawing.Size(123, 34);
label2.TabIndex = 198;
label2.Text = "Next File Shortcut Key";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
2021-12-29 19:14:00 +00:00
//
2021-10-24 15:49:48 +00:00
// OptionsForm
2021-12-29 19:14:00 +00:00
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(384, 521);
Controls.Add(label2);
Controls.Add(tHorizontalSeparator3);
Controls.Add(label1);
Controls.Add(pickerBox3);
Controls.Add(textBox1);
Controls.Add(pickerBox2);
Controls.Add(tHorizontalSeparator2);
Controls.Add(tHorizontalSeparator1);
Controls.Add(label8);
Controls.Add(pickerBox1);
Controls.Add(label6);
Controls.Add(button1);
MinimumSize = new System.Drawing.Size(400, 560);
Name = "OptionsForm";
ShowIcon = false;
ShowInTaskbar = false;
Text = "Options";
ResumeLayout(false);
PerformLayout();
2021-10-24 15:49:48 +00:00
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
this.DialogResult = System.Windows.Forms.DialogResult.None;
2021-10-30 02:21:45 +00:00
pickerBox1.Value = this.Session.SearchTopDirectoryOnly;
pickerBox2.Value = this.Session.RetryOnError;
//pickerBox2.Clear.Clear(0, 20, this.Session.RetryOnError);
2021-10-30 02:21:45 +00:00
pickerBox3.Value = this.Session.ClosePrevOnNext;
if (this.Session.NextHotKey != null) textBox1.UpdateKeyCode(this.Session.NextHotKey.IsCtrl, this.Session.NextHotKey.IsAlt, this.Session.NextHotKey.IsShift, this.Session.NextHotKey.KeyCode);
2021-10-24 15:49:48 +00:00
}
public AppSession Session { get; protected set; }
private void button1_MouseClick(object sender, MouseEventArgs e)
{
if (this.Session == null) this.Session = new AppSession();
2021-10-30 02:21:45 +00:00
this.Session.SearchTopDirectoryOnly = pickerBox1.Value;
this.Session.RetryOnError = pickerBox2.Value;
this.Session.ClosePrevOnNext = pickerBox3.Value;
this.Session.NextHotKey.IsCtrl = textBox1.KeyCodeResults.IsCtrl;
this.Session.NextHotKey.IsAlt = textBox1.KeyCodeResults.IsAlt;
this.Session.NextHotKey.IsShift = textBox1.KeyCodeResults.IsShift;
this.Session.NextHotKey.Key = textBox1.KeyCodeResults.KeyCode;
2021-10-24 15:49:48 +00:00
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}