random-file-runner/OptionsForm.cs

281 lines
12 KiB
C#
Raw Permalink Normal View History

using System;
using System.Windows.Forms;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
using RyzStudio.Windows.ThemedForms.PickerBox;
2021-10-24 15:49:48 +00:00
namespace RandomFileRunner
{
public class OptionsForm : Form
2021-10-24 15:49:48 +00:00
{
private ThYesNoPickerBox pickerBox1;
2021-10-24 15:49:48 +00:00
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
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;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private AppSession _session = null;
2021-10-24 15:49:48 +00:00
public OptionsForm(AppSession session) : base()
{
InitializeComponent();
UISetup.Dialog(this);
_session = session;
if (_session != null)
{
pickerBox1.Value = _session.SearchTopDirectoryOnly;
pickerBox2.Value = _session.RetryOnError;
pickerBox3.Value = _session.ClosePrevOnNext;
if (_session.NextHotKey != null)
{
textBox1.UpdateKeyCode(_session.NextHotKey.IsCtrl, _session.NextHotKey.IsAlt, _session.NextHotKey.IsShift, _session.NextHotKey.KeyCode);
}
}
2021-10-24 15:49:48 +00:00
}
private void InitializeComponent()
{
ThKeyCodeTextBox.Results results1 = new ThKeyCodeTextBox.Results();
pickerBox1 = new ThYesNoPickerBox();
label6 = new Label();
label8 = new Label();
tHorizontalSeparator2 = new THorizontalSeparator();
pickerBox2 = new ThNumericPickerBox();
textBox1 = new ThKeyCodeTextBox();
pickerBox3 = new ThYesNoPickerBox();
label1 = new Label();
tHorizontalSeparator3 = new THorizontalSeparator();
label2 = new Label();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
SuspendLayout();
//
2021-10-24 15:49:48 +00:00
// pickerBox1
//
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, 20);
pickerBox1.Name = "pickerBox1";
pickerBox1.SelectedIndex = 1;
pickerBox1.Size = new System.Drawing.Size(84, 35);
pickerBox1.TabIndex = 0;
pickerBox1.TabStop = false;
pickerBox1.Value = true;
//
2021-10-24 15:49:48 +00:00
// label6
//
label6.AutoSize = true;
label6.BackColor = System.Drawing.Color.Transparent;
label6.ForeColor = System.Drawing.SystemColors.ControlText;
label6.Location = new System.Drawing.Point(10, 95);
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-10-24 15:49:48 +00:00
// label8
//
label8.AutoSize = true;
label8.BackColor = System.Drawing.Color.Transparent;
label8.ForeColor = System.Drawing.SystemColors.ControlText;
label8.Location = new System.Drawing.Point(10, 20);
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-10-24 15:49:48 +00:00
// tHorizontalSeparator2
//
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, 64);
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-10-24 15:49:48 +00:00
// pickerBox2
//
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, 95);
pickerBox2.MaxDropDownItems = 10;
pickerBox2.Maximum = 50;
pickerBox2.Minimum = 0;
pickerBox2.Name = "pickerBox2";
pickerBox2.SelectedIndex = 0;
pickerBox2.Size = new System.Drawing.Size(84, 35);
pickerBox2.TabIndex = 1;
pickerBox2.TabStop = false;
pickerBox2.Value = 0;
//
2021-10-30 02:21:45 +00:00
// textBox1
//
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.Icon = "O";
textBox1.IconSize = 13F;
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, 216);
textBox1.Name = "textBox1";
textBox1.Size = new System.Drawing.Size(128, 32);
textBox1.TabIndex = 3;
textBox1.TabStop = false;
textBox1.UseSystemPasswordChar = false;
//
2021-10-30 02:21:45 +00:00
// pickerBox3
//
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, 140);
pickerBox3.Name = "pickerBox3";
pickerBox3.SelectedIndex = 1;
pickerBox3.Size = new System.Drawing.Size(84, 35);
pickerBox3.TabIndex = 2;
pickerBox3.TabStop = false;
pickerBox3.Value = true;
//
2021-10-30 02:21:45 +00:00
// label1
//
label1.AutoSize = true;
label1.BackColor = System.Drawing.Color.Transparent;
label1.ForeColor = System.Drawing.SystemColors.ControlText;
label1.Location = new System.Drawing.Point(10, 140);
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-10-30 02:21:45 +00:00
// tHorizontalSeparator3
//
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, 184);
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-10-30 02:21:45 +00:00
// label2
//
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent;
label2.ForeColor = System.Drawing.SystemColors.ControlText;
label2.Location = new System.Drawing.Point(10, 216);
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;
//
// 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(384, 84);
//
2021-10-24 15:49:48 +00:00
// OptionsForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = System.Drawing.Color.White;
ClientSize = new System.Drawing.Size(384, 521);
Controls.Add(dialogFooter1);
Controls.Add(label2);
Controls.Add(tHorizontalSeparator3);
Controls.Add(label1);
Controls.Add(pickerBox3);
Controls.Add(textBox1);
Controls.Add(pickerBox2);
Controls.Add(tHorizontalSeparator2);
Controls.Add(label8);
Controls.Add(pickerBox1);
Controls.Add(label6);
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);
pickerBox1.Focus();
2021-10-24 15:49:48 +00:00
}
public AppSession Result
2021-10-24 15:49:48 +00:00
{
get
{
if (_session == null)
{
_session = new AppSession();
}
2021-10-24 15:49:48 +00:00
_session.SearchTopDirectoryOnly = pickerBox1.Value;
_session.RetryOnError = pickerBox2.Value;
_session.ClosePrevOnNext = pickerBox3.Value;
_session.NextHotKey.IsCtrl = textBox1.KeyCodeResults.IsCtrl;
_session.NextHotKey.IsAlt = textBox1.KeyCodeResults.IsAlt;
_session.NextHotKey.IsShift = textBox1.KeyCodeResults.IsShift;
_session.NextHotKey.Key = textBox1.KeyCodeResults.KeyCode;
2021-10-24 15:49:48 +00:00
return _session;
}
2021-10-24 15:49:48 +00:00
}
}
}