Skip to content

Commit af1da81

Browse files
committed
...
1 parent c9b3e9f commit af1da81

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

SmartImage 3/Mode/Shell/ShellMode.Handlers.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33

44
using System.Diagnostics;
55
using Kantan.Net.Utilities;
6+
using Microsoft.VisualBasic.FileIO;
67
using Novus.OS;
78
using NStack;
89
using SmartImage.App;
910
using SmartImage.Lib;
1011
using SmartImage.Mode.Shell.Assets;
1112
using Terminal.Gui;
13+
using Clipboard = Novus.Win32.Clipboard;
14+
using Microsoft.VisualBasic.FileIO;
15+
using FileSystem = Novus.OS.FileSystem;
1216

1317
namespace SmartImage.Mode.Shell;
1418

@@ -85,7 +89,7 @@ private void Restart_Clicked(bool force = false)
8589
/// </summary>
8690
private async void Run_Clicked()
8791
{
88-
Btn_Run.Enabled = false;
92+
Btn_Run.Enabled = false;
8993
// Btn_Delete.Enabled = false;
9094

9195
var text = Tf_Input.Text;
@@ -115,7 +119,7 @@ private void Browse_Clicked()
115119
if (!string.IsNullOrWhiteSpace(f)) {
116120
Tf_Input.DeleteAll();
117121
Debug.WriteLine($"Picked file: {f}", nameof(Browse_Clicked));
118-
122+
119123
SetInputText(f);
120124
Btn_Run.SetFocus();
121125

@@ -168,4 +172,23 @@ private void Cancel_Clicked()
168172
Application.MainLoop.RemoveIdle(m_runIdleTok);
169173
Tv_Results.SetFocus();
170174
}
175+
176+
private void On_Delete()
177+
{
178+
Clipboard.Close();
179+
// Restart_Clicked(true);
180+
181+
var file = Tf_Input.Text.ToString();
182+
183+
if (!string.IsNullOrWhiteSpace(file)) {
184+
Query.Dispose();
185+
Debug.WriteLine($"{IsQueryReady()}");
186+
187+
Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(file, UIOption.OnlyErrorDialogs,
188+
RecycleOption.SendToRecycleBin);
189+
Debug.WriteLine($"deleted {file}");
190+
Clear();
191+
}
192+
193+
}
171194
}

SmartImage 3/Mode/Shell/ShellMode.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -412,23 +412,6 @@ public ShellMode(string[] args)
412412
}
413413
}
414414

415-
private void On_Delete()
416-
{
417-
Clipboard.Close();
418-
Restart_Clicked(true);
419-
420-
var file = Tf_Input.Text.ToString();
421-
422-
if (!string.IsNullOrWhiteSpace(file)) {
423-
Query.Dispose();
424-
Debug.WriteLine($"{IsQueryReady()}");
425-
FileSystem.DeleteFile(file, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
426-
Debug.WriteLine($"deleted {file}");
427-
Clear();
428-
}
429-
430-
}
431-
432415
public Task<object?> RunAsync(object? sender = null)
433416
{
434417
Application.Run();

0 commit comments

Comments
 (0)