diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
index 1966582..8a2014d 100644
--- a/MainForm.Designer.cs
+++ b/MainForm.Designer.cs
@@ -306,11 +306,9 @@ namespace RandomFileRunner
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.BackColor = System.Drawing.Color.Transparent;
this.textBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.textBox1.HighlightImage = ((System.Drawing.Image)(resources.GetObject("textBox1.HighlightImage")));
this.textBox1.Location = new System.Drawing.Point(127, 36);
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 0, 0, 10);
this.textBox1.Name = "textBox1";
- this.textBox1.NormalImage = ((System.Drawing.Image)(resources.GetObject("textBox1.NormalImage")));
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 9, 9, 9);
this.textBox1.Size = new System.Drawing.Size(318, 34);
this.textBox1.SubmitButton = null;
diff --git a/MainForm.cs b/MainForm.cs
index 8d2f919..985e60c 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -7,6 +7,7 @@ using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.Json;
+using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -29,7 +30,8 @@ namespace RandomFileRunner
protected const int WM_QUERYENDSESSION = 0x0011;
- protected readonly Random randy;
+ protected readonly Random randy = new Random();
+ protected CancellationTokenSource cancellationToken = new CancellationTokenSource();
protected OptionsForm optionsForm = null;
protected bool isBusy = false;
@@ -45,8 +47,6 @@ namespace RandomFileRunner
textBox1.Text = "*.*";
memoBox1.InnerTextBox.WordWrap = false;
-
- randy = new Random();
}
protected async override void OnShown(EventArgs e)
@@ -116,7 +116,7 @@ namespace RandomFileRunner
{
isBusy = value;
- ThreadControl.SetValue(pictureBox1, (isBusy ? RyzStudio.UIResource.loading_block : null));
+ ThreadControl.SetValue(pictureBox1, (isBusy ? UIcon.GetImage("loading_block") : null));
ThreadControl.SetEnable(textBox1, !isBusy);
//ThreadControl.SetEnable(button2, !isBusy);
button2.LabelText = (isBusy? "&Cancel" : "&Search");
@@ -260,12 +260,13 @@ namespace RandomFileRunner
///
private async void button2_MouseClick(object sender, MouseEventArgs e)
{
- await Task.Run(() =>
+ await Task.Run(async () =>
{
if (this.IsBusy)
{
requestCancel = true;
button2.LabelText = "&Cancelling...";
+ cancellationToken.Cancel();
return;
}
@@ -274,6 +275,7 @@ namespace RandomFileRunner
requestCancel = false;
foundFiles = new List();
+ cancellationToken = new CancellationTokenSource();
currentProcess = null;
if (!string.IsNullOrWhiteSpace(memoBox1.Text))
@@ -299,7 +301,7 @@ namespace RandomFileRunner
if (Directory.Exists(item))
{
- AccessibleDirectory.GetFiles(item, textBox1.Text, this.CurrentSession.SearchTopDirectoryOnly, SearchDirecory_OnFound);
+ await AccessibleDirectory.GetFilesAsync(item, textBox1.Text, this.CurrentSession.SearchTopDirectoryOnly, SearchDirecory_OnFound, cancellationToken.Token);
ThreadControl.SetText(label2, foundFiles.Count.ToString());
diff --git a/MainForm.resx b/MainForm.resx
index 4ea862d..0b92a50 100644
--- a/MainForm.resx
+++ b/MainForm.resx
@@ -1,4 +1,64 @@
-
+
+
+
@@ -52,55 +112,38 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
17, 17
-
-
+
+
716, 17
-
-
+
+
831, 17
-
-
+
+
986, 17
-
-
- 1155, 17
-
-
-
-
- iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAYAAAAmlE46AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAClSURBVDhP7dI/
- DgFBGIbxSVTKjcRx3MLqXYCOjkocQcMF3MAZOIKaE5AthOexf2QnbJQKb/JLJvO9XzLFhCgtbHDBveB5
- DWcfM8ANC0wKnr1LUUsbHXSxxBlJxDtnduy6E04on/Utd0IPOxwxxBT9iHfO7Nh155kV9vmxMXbsVvkv
- vvIji4f82Bg7tcUxrpih/NyxOeyMUMVPu0WGd39TzuzQDeEB5/ZKvTSyulEAAAAASUVORK5CYII=
-
-
-
- iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAYAAAAmlE46AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADTSURBVDhP7ZI7
- CsJQEEUfWFmK4HLchdpnA9ppp5W4BBtdQNyBC0ilRf6VdVyBwUL03JdXxC/YWThwmDcz94YJjKmH7/uN
- OI7XaZqekiS5Cr1hpZmTPQemAeILeU4eC/dWr+9kVQRB0MzzvB2GYQfBAsExiqJWHfU0k0ZaeQyNAuxa
- X1CYLMu6/MOW4kD2YAK9B9TznGYrj12XVZY0drb4ENJI68q/sR4/YoS9K9+GNHdGLmIEJV+cku1xP4Jh
- Ri7JQ2erDp3mBs7w6jaFZht74MaYGwmLbkeRGexGAAAAAElFTkSuQmCC
-
-
-
+
1155, 17
-
-
+
+
+ 1155, 17
+
+
1295, 17
-
-
+
+
+
108
-
+
+
AAABAAQAMDAAAAEAIACoJQAARgAAACAgAAABACAAqBAAAO4lAAAYGAAAAQAgAIgJAACWNgAAEBAAAAEA
diff --git a/Program.cs b/Program.cs
index 83a0f7c..517cd8c 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,7 +1,5 @@
+using RyzStudio.IO;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace RandomFileRunner
@@ -14,6 +12,8 @@ namespace RandomFileRunner
[STAThread]
static void Main()
{
+ UIcon.UIResource = typeof(UIResource);
+
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
diff --git a/RandomFileRunner.csproj b/RandomFileRunner.csproj
index b021e2c..aa9f2e8 100644
--- a/RandomFileRunner.csproj
+++ b/RandomFileRunner.csproj
@@ -11,7 +11,7 @@
Ray Lam
favicon.ico
true
- 0.1.1.005
+ 0.1.2.034
@@ -19,6 +19,10 @@
false
+
+ x64
+
+
@@ -28,19 +32,23 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
References\RyzStudio3.dll
@@ -53,6 +61,11 @@
True
AppResource.resx
+
+ True
+ True
+ UIResource.resx
+
@@ -60,6 +73,10 @@
ResXFileCodeGenerator
AppResource.Designer.cs
+
+ PublicResXFileCodeGenerator
+ UIResource.Designer.cs
+
\ No newline at end of file
diff --git a/References/RyzStudio3.dll b/References/RyzStudio3.dll
index 7fa0e80..4d9321c 100644
Binary files a/References/RyzStudio3.dll and b/References/RyzStudio3.dll differ
diff --git a/Resources/loading-block.gif b/Resources/loading-block.gif
new file mode 100644
index 0000000..a5aa827
Binary files /dev/null and b/Resources/loading-block.gif differ
diff --git a/Resources/trash-2.png b/Resources/trash-2.png
new file mode 100644
index 0000000..97951dd
Binary files /dev/null and b/Resources/trash-2.png differ
diff --git a/Resources/trash.png b/Resources/trash.png
new file mode 100644
index 0000000..6c96440
Binary files /dev/null and b/Resources/trash.png differ
diff --git a/UIResource.Designer.cs b/UIResource.Designer.cs
new file mode 100644
index 0000000..9892765
--- /dev/null
+++ b/UIResource.Designer.cs
@@ -0,0 +1,93 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace RandomFileRunner {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class UIResource {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal UIResource() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RandomFileRunner.UIResource", typeof(UIResource).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap loading_block {
+ get {
+ object obj = ResourceManager.GetObject("loading_block", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap trash {
+ get {
+ object obj = ResourceManager.GetObject("trash", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap trash_2 {
+ get {
+ object obj = ResourceManager.GetObject("trash_2", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/UIResource.resx b/UIResource.resx
new file mode 100644
index 0000000..9703ecc
--- /dev/null
+++ b/UIResource.resx
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ Resources\loading-block.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\trash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\trash-2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file