|
10 | 10 | using System.Runtime.Versioning; |
11 | 11 | using Kantan.Net.Utilities; |
12 | 12 | using Kantan.Text; |
| 13 | +using Microsoft.VisualBasic.FileIO; |
13 | 14 | using Novus.Win32; |
14 | 15 | using NStack; |
15 | 16 | using SmartImage.App; |
@@ -198,6 +199,26 @@ public sealed partial class ShellMain : IDisposable, IMain |
198 | 199 |
|
199 | 200 | }; |
200 | 201 |
|
| 202 | + private static readonly Button Btn_Queue = new("Queue") |
| 203 | + { |
| 204 | + X = Pos.X(Btn_Run), |
| 205 | + Y = Pos.Bottom(Btn_Run), |
| 206 | + |
| 207 | + Height = Dim.Height(Btn_Run), |
| 208 | + ColorScheme = UI.Cs_Lbl1 |
| 209 | + |
| 210 | + }; |
| 211 | + |
| 212 | + private static readonly Button Btn_Delete = new("Delete") |
| 213 | + { |
| 214 | + X = Pos.X(Btn_Cancel), |
| 215 | + Y = Pos.Bottom(Btn_Cancel), |
| 216 | + |
| 217 | + Height = Dim.Height(Btn_Cancel), |
| 218 | + ColorScheme = UI.Cs_Btn4 |
| 219 | + |
| 220 | + }; |
| 221 | + |
201 | 222 | #endregion |
202 | 223 |
|
203 | 224 | #region Fields/properties |
@@ -346,10 +367,23 @@ public ShellMain(string[] args) |
346 | 367 | HttpUtilities.TryOpenUrl(Query.Upload); |
347 | 368 | }; |
348 | 369 |
|
| 370 | + Btn_Delete.Clicked += () => |
| 371 | + { |
| 372 | + var file = Tf_Input.Text.ToString(); |
| 373 | + |
| 374 | + if (!string.IsNullOrWhiteSpace(file)) { |
| 375 | + Query.Dispose(); |
| 376 | + FileSystem.DeleteFile(file, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); |
| 377 | + Debug.WriteLine($"deleted {file}"); |
| 378 | + Clear(); |
| 379 | + } |
| 380 | + |
| 381 | + }; |
| 382 | + |
349 | 383 | Win.Add(Lbl_Input, Tf_Input, Btn_Run, Lbl_InputOk, |
350 | 384 | Btn_Clear, Tv_Results, Pbr_Status, Lbl_InputInfo, Lbl_QueryUpload, |
351 | 385 | Btn_Restart, Btn_Config, Lbl_InputInfo2, Btn_Cancel, Lbl_Status, Btn_Browse, |
352 | | - Lbl_Status2 |
| 386 | + Lbl_Status2, Btn_Queue, Btn_Delete |
353 | 387 | ); |
354 | 388 |
|
355 | 389 | Top.Add(Win); |
@@ -552,9 +586,9 @@ private async Task<bool> SetQuery(ustring text) |
552 | 586 |
|
553 | 587 | } |
554 | 588 | else { |
555 | | - UI.SetLabelStatus(Lbl_InputOk, false); |
| 589 | + Lbl_InputInfo.Text = "Error: invalid input"; |
556 | 590 |
|
557 | | - Lbl_InputInfo.Text = "Error: invalid input"; |
| 591 | + UI.SetLabelStatus(Lbl_InputOk, false); |
558 | 592 | Btn_Run.Enabled = true; |
559 | 593 | Lbl_QueryUpload.Text = ustring.Empty; |
560 | 594 | Pbr_Status.Fraction = 0; |
|
0 commit comments