diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
index 3ed0c6b..6be02f5 100644
--- a/MainForm.Designer.cs
+++ b/MainForm.Designer.cs
@@ -41,14 +41,9 @@ namespace RandomFileRunner
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
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.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator();
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.optionsToolStripMenuItem = 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.fileToolStripMenuItem,
- this.toolStripMenuItem1,
- this.viewToolStripMenuItem,
this.toolsToolStripMenuItem,
this.helpToolStripMenuItem1});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
@@ -140,9 +133,6 @@ namespace RandomFileRunner
this.newToolStripMenuItem,
this.openToolStripMenuItem,
this.toolStripMenuItem13,
- this.closeToolStripMenuItem,
- this.toolStripMenuItem14,
- this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem,
this.toolStripMenuItem15,
this.exitToolStripMenuItem2});
@@ -154,44 +144,29 @@ namespace RandomFileRunner
//
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
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.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
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.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// toolStripMenuItem13
//
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
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
//
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.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
//
// toolStripMenuItem15
//
@@ -201,20 +176,9 @@ namespace RandomFileRunner
// 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";
- //
- // 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";
+ this.exitToolStripMenuItem2.Click += new System.EventHandler(this.exitToolStripMenuItem2_Click);
//
// toolsToolStripMenuItem
//
@@ -228,7 +192,7 @@ namespace RandomFileRunner
//
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
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.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click);
//
@@ -246,19 +210,21 @@ namespace RandomFileRunner
//
this.viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
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.Click += new System.EventHandler(this.viewHelpToolStripMenuItem1_Click);
//
// toolStripMenuItem16
//
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
- this.toolStripMenuItem16.Size = new System.Drawing.Size(143, 6);
+ this.toolStripMenuItem16.Size = new System.Drawing.Size(177, 6);
//
// 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.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
//
// contextMenuStrip1
//
@@ -408,7 +374,7 @@ namespace RandomFileRunner
this.memoBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.memoBox1.Name = "memoBox1";
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.DragDrop += new System.Windows.Forms.DragEventHandler(this.memoBox1_DragDrop);
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 openToolStripMenuItem;
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.ToolStripSeparator toolStripMenuItem15;
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 optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem1;
diff --git a/MainForm.cs b/MainForm.cs
index 140ba35..61176ae 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -129,6 +129,58 @@ namespace RandomFileRunner
}
+
+ ///
+ /// New
+ ///
+ ///
+ ///
+ 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();
+ currentProcess = null;
+ textBox1.Text = "*.*";
+ ThreadControl.SetText(label2, "0");
+ memoBox1.Text = string.Empty;
+ });
+ }
+
+ ///
+ /// Open
+ ///
+ ///
+ ///
+ private void openToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ ///
+ /// Save as
+ ///
+ ///
+ ///
+ private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ ///
+ /// Close
+ ///
+ ///
+ ///
+ private void exitToolStripMenuItem2_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
///
/// Options
///
@@ -136,10 +188,7 @@ namespace RandomFileRunner
///
private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
{
- if (this.IsBusy)
- {
- return;
- }
+ if (this.IsBusy) return;
if (optionsForm == null) optionsForm = new OptionsForm(this.CurrentSession);
if (optionsForm.ShowDialog() == DialogResult.OK)
@@ -147,10 +196,40 @@ namespace RandomFileRunner
this.CurrentSession = optionsForm.Session;
InvalidateHotKey();
- //this.TopMost = this.CurrentSession.AlwaysOnTop;
}
}
+ ///
+ /// Help
+ ///
+ ///
+ ///
+ 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
+ }
+ }
+
+ ///
+ /// About
+ ///
+ ///
+ ///
+ private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
+ {
+ MessageBox.Show(Application.ProductName + " v" + Application.ProductVersion, "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+
///
/// Search
@@ -175,36 +254,39 @@ namespace RandomFileRunner
foundFiles = new List();
currentProcess = null;
- string[] itemList = memoBox1.Text?.Trim().Split('\n');
- for (int i=0; i< itemList.Length; i++)
+ if (!string.IsNullOrWhiteSpace(memoBox1.Text))
{
- if (string.IsNullOrWhiteSpace(itemList[i])) continue;
- if (requestCancel) break;
-
- string item = itemList[i]?.Trim();
-
- if (File.Exists(item))
+ string[] itemList = memoBox1.Text?.Trim().Split('\n');
+ for (int i = 0; i < itemList.Length; i++)
{
- if (SmartDirectory.IsFileAccessible(item))
+ if (string.IsNullOrWhiteSpace(itemList[i])) continue;
+ if (requestCancel) break;
+
+ string item = itemList[i]?.Trim();
+
+ if (File.Exists(item))
{
- foundFiles.Add(item);
+ if (SmartDirectory.IsFileAccessible(item))
+ {
+ foundFiles.Add(item);
+ ThreadControl.SetText(label2, foundFiles.Count.ToString());
+
+ continue;
+ }
+ }
+
+ if (Directory.Exists(item))
+ {
+ SmartDirectory.GetFiles(item, textBox1.Text, this.CurrentSession.SearchTopDirectoryOnly, SearchDirecory_OnFound);
+
ThreadControl.SetText(label2, foundFiles.Count.ToString());
continue;
}
}
-
- if (Directory.Exists(item))
- {
- SmartDirectory.GetFiles(item, textBox1.Text, this.CurrentSession.SearchTopDirectoryOnly, SearchDirecory_OnFound);
-
- ThreadControl.SetText(label2, foundFiles.Count.ToString());
-
- 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;
requestCancel = false;
diff --git a/RyzStudio/Windows/ThemedForms/TMemoBox.cs b/RyzStudio/Windows/ThemedForms/TMemoBox.cs
index cc2b320..f22d2ac 100644
--- a/RyzStudio/Windows/ThemedForms/TMemoBox.cs
+++ b/RyzStudio/Windows/ThemedForms/TMemoBox.cs
@@ -1,6 +1,7 @@
namespace RyzStudio.Windows.ThemedForms
{
using RyzStudio.Drawing;
+ using RyzStudio.Windows.Forms;
using System;
using System.ComponentModel;
using System.Drawing;
@@ -39,7 +40,7 @@
[Browsable(true), EditorBrowsable(EditorBrowsableState.Advanced)]
[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)]
public new Padding Margin { get { return base.Margin; } set { base.Margin = value; } }