WIP: main menu

This commit is contained in:
Ray 2021-10-30 23:44:44 +01:00
parent fe6a14c4ad
commit e0c118cb0b
3 changed files with 124 additions and 80 deletions

69
MainForm.Designer.cs generated
View File

@ -41,14 +41,9 @@ namespace RandomFileRunner
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripSeparator();
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripSeparator();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
@ -125,8 +120,6 @@ namespace RandomFileRunner
// //
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem, this.fileToolStripMenuItem,
this.toolStripMenuItem1,
this.viewToolStripMenuItem,
this.toolsToolStripMenuItem, this.toolsToolStripMenuItem,
this.helpToolStripMenuItem1}); this.helpToolStripMenuItem1});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
@ -140,9 +133,6 @@ namespace RandomFileRunner
this.newToolStripMenuItem, this.newToolStripMenuItem,
this.openToolStripMenuItem, this.openToolStripMenuItem,
this.toolStripMenuItem13, this.toolStripMenuItem13,
this.closeToolStripMenuItem,
this.toolStripMenuItem14,
this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem, this.saveAsToolStripMenuItem,
this.toolStripMenuItem15, this.toolStripMenuItem15,
this.exitToolStripMenuItem2}); this.exitToolStripMenuItem2});
@ -154,44 +144,29 @@ namespace RandomFileRunner
// //
this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.newToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.newToolStripMenuItem.Text = "&New"; this.newToolStripMenuItem.Text = "&New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
// //
// openToolStripMenuItem // openToolStripMenuItem
// //
this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.openToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.openToolStripMenuItem.Text = "&Open"; this.openToolStripMenuItem.Text = "&Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
// //
// toolStripMenuItem13 // toolStripMenuItem13
// //
this.toolStripMenuItem13.Name = "toolStripMenuItem13"; this.toolStripMenuItem13.Name = "toolStripMenuItem13";
this.toolStripMenuItem13.Size = new System.Drawing.Size(143, 6); this.toolStripMenuItem13.Size = new System.Drawing.Size(143, 6);
// //
// closeToolStripMenuItem
//
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
this.closeToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.closeToolStripMenuItem.Text = "&Close";
//
// toolStripMenuItem14
//
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(143, 6);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.saveToolStripMenuItem.Text = "&Save";
//
// saveAsToolStripMenuItem // saveAsToolStripMenuItem
// //
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveAsToolStripMenuItem.Text = "Save &As..."; this.saveAsToolStripMenuItem.Text = "Save &As...";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
// //
// toolStripMenuItem15 // toolStripMenuItem15
// //
@ -201,20 +176,9 @@ namespace RandomFileRunner
// exitToolStripMenuItem2 // exitToolStripMenuItem2
// //
this.exitToolStripMenuItem2.Name = "exitToolStripMenuItem2"; this.exitToolStripMenuItem2.Name = "exitToolStripMenuItem2";
this.exitToolStripMenuItem2.Size = new System.Drawing.Size(146, 22); this.exitToolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.exitToolStripMenuItem2.Text = "E&xit"; this.exitToolStripMenuItem2.Text = "E&xit";
// this.exitToolStripMenuItem2.Click += new System.EventHandler(this.exitToolStripMenuItem2_Click);
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(39, 20);
this.toolStripMenuItem1.Text = "&Edit";
//
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "&View";
// //
// toolsToolStripMenuItem // toolsToolStripMenuItem
// //
@ -228,7 +192,7 @@ namespace RandomFileRunner
// //
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12))); this.optionsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12)));
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.optionsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.optionsToolStripMenuItem.Text = "&Options"; this.optionsToolStripMenuItem.Text = "&Options";
this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click); this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click);
// //
@ -246,19 +210,21 @@ namespace RandomFileRunner
// //
this.viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1"; this.viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
this.viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1; this.viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
this.viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22); this.viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.viewHelpToolStripMenuItem1.Text = "&View Help"; this.viewHelpToolStripMenuItem1.Text = "&View Help";
this.viewHelpToolStripMenuItem1.Click += new System.EventHandler(this.viewHelpToolStripMenuItem1_Click);
// //
// toolStripMenuItem16 // toolStripMenuItem16
// //
this.toolStripMenuItem16.Name = "toolStripMenuItem16"; this.toolStripMenuItem16.Name = "toolStripMenuItem16";
this.toolStripMenuItem16.Size = new System.Drawing.Size(143, 6); this.toolStripMenuItem16.Size = new System.Drawing.Size(177, 6);
// //
// aboutToolStripMenuItem1 // aboutToolStripMenuItem1
// //
this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1"; this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(146, 22); this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.aboutToolStripMenuItem1.Text = "&About"; this.aboutToolStripMenuItem1.Text = "&About";
this.aboutToolStripMenuItem1.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
// //
// contextMenuStrip1 // contextMenuStrip1
// //
@ -408,7 +374,7 @@ namespace RandomFileRunner
this.memoBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); this.memoBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.memoBox1.Name = "memoBox1"; this.memoBox1.Name = "memoBox1";
this.memoBox1.Padding = new System.Windows.Forms.Padding(10, 10, 3, 9); this.memoBox1.Padding = new System.Windows.Forms.Padding(10, 10, 3, 9);
this.memoBox1.Size = new System.Drawing.Size(432, 376); this.memoBox1.Size = new System.Drawing.Size(432, 464);
this.memoBox1.TabIndex = 48; this.memoBox1.TabIndex = 48;
this.memoBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.memoBox1_DragDrop); this.memoBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.memoBox1_DragDrop);
this.memoBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.memoBox1_DragOver); this.memoBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.memoBox1_DragOver);
@ -475,14 +441,9 @@ namespace RandomFileRunner
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem13; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem13;
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem14;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem1;

View File

@ -129,6 +129,58 @@ namespace RandomFileRunner
} }
/// <summary>
/// New
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void newToolStripMenuItem_Click(object sender, EventArgs e)
{
await Task.Run(() =>
{
if (this.IsBusy) return;
if (this.CurrentSession.ClosePrevOnNext) CloseCurrentProcess(currentProcess);
foundFiles = new List<string>();
currentProcess = null;
textBox1.Text = "*.*";
ThreadControl.SetText(label2, "0");
memoBox1.Text = string.Empty;
});
}
/// <summary>
/// Open
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
}
/// <summary>
/// Save as
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
}
/// <summary>
/// Close
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void exitToolStripMenuItem2_Click(object sender, EventArgs e)
{
this.Close();
}
/// <summary> /// <summary>
/// Options /// Options
/// </summary> /// </summary>
@ -136,10 +188,7 @@ namespace RandomFileRunner
/// <param name="e"></param> /// <param name="e"></param>
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (this.IsBusy) if (this.IsBusy) return;
{
return;
}
if (optionsForm == null) optionsForm = new OptionsForm(this.CurrentSession); if (optionsForm == null) optionsForm = new OptionsForm(this.CurrentSession);
if (optionsForm.ShowDialog() == DialogResult.OK) if (optionsForm.ShowDialog() == DialogResult.OK)
@ -147,10 +196,40 @@ namespace RandomFileRunner
this.CurrentSession = optionsForm.Session; this.CurrentSession = optionsForm.Session;
InvalidateHotKey(); InvalidateHotKey();
//this.TopMost = this.CurrentSession.AlwaysOnTop;
} }
} }
/// <summary>
/// Help
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void viewHelpToolStripMenuItem1_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(new ProcessStartInfo()
{
FileName = "https://www.hiimray.co.uk",
UseShellExecute = true
});
}
catch
{
// do nothing
}
}
/// <summary>
/// About
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
{
MessageBox.Show(Application.ProductName + " v" + Application.ProductVersion, "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
/// <summary> /// <summary>
/// Search /// Search
@ -175,6 +254,8 @@ namespace RandomFileRunner
foundFiles = new List<string>(); foundFiles = new List<string>();
currentProcess = null; currentProcess = null;
if (!string.IsNullOrWhiteSpace(memoBox1.Text))
{
string[] itemList = memoBox1.Text?.Trim().Split('\n'); string[] itemList = memoBox1.Text?.Trim().Split('\n');
for (int i = 0; i < itemList.Length; i++) for (int i = 0; i < itemList.Length; i++)
{ {
@ -203,8 +284,9 @@ namespace RandomFileRunner
continue; continue;
} }
} }
}
ThreadControl.SetText(label2, foundFiles.Count.ToString("#,#", System.Globalization.CultureInfo.CurrentCulture) + " File" + ((foundFiles.Count == 1) ? "" : "s") + " Found"); ThreadControl.SetText(label2, ((foundFiles.Count <= 0) ? "0" :foundFiles.Count.ToString("#,#", System.Globalization.CultureInfo.CurrentCulture)) + " File" + ((foundFiles.Count == 1) ? "" : "s") + " Found");
this.IsBusy = false; this.IsBusy = false;
requestCancel = false; requestCancel = false;

View File

@ -1,6 +1,7 @@
namespace RyzStudio.Windows.ThemedForms namespace RyzStudio.Windows.ThemedForms
{ {
using RyzStudio.Drawing; using RyzStudio.Drawing;
using RyzStudio.Windows.Forms;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
@ -39,7 +40,7 @@
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)] [Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[Category("Appearance")] [Category("Appearance")]
public new string Text { get => textBox1.Text; set => textBox1.Text = value; } public new string Text { get => ThreadControl.GetText(textBox1); set => ThreadControl.SetText(textBox1, value); }
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } } public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } }