Skip to content

Commit b838523

Browse files
committed
Improve progress bar UI
1 parent f28e5c2 commit b838523

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

SmartImage 3/Modes/GuiMode.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ public sealed class GuiMode : BaseProgramMode
172172
Y = Pos.Y(Tf_Input),
173173
Width = 10,
174174
ProgressBarStyle = ProgressBarStyle.Continuous,
175+
BidirectionalMarquee = false,
176+
ProgressBarFormat = ProgressBarFormat.SimplePlusPercentage
175177
};
176178

177179
private static readonly Label Lbl_Status = new()
@@ -208,7 +210,7 @@ public GuiMode(string[] args) : base(args, SearchQuery.Null)
208210
m_cbCallbackTok = Application.MainLoop.AddTimeout(TimeoutTimeSpan, ClipboardCallback);
209211

210212
m_clipboard = new List<ustring>();
211-
213+
212214
Mb_Menu.Menus = new MenuBarItem[]
213215
{
214216
new("_About", null, AboutDialog),
@@ -428,8 +430,16 @@ private async Task<bool> SetQuery(ustring text)
428430
if (sq is { } && sq != SearchQuery.Null) {
429431

430432
try {
431-
var u = await sq.UploadAsync();
433+
Pbr_Status.BidirectionalMarquee = true;
434+
Pbr_Status.ProgressBarStyle = ProgressBarStyle.MarqueeContinuous;
435+
Pbr_Status.Pulse();
436+
var t = sq.UploadAsync();
437+
Pbr_Status.Pulse();
438+
var u = await t;
439+
Pbr_Status.Pulse();
440+
432441
Lbl_QueryUpload.Text = u.ToString();
442+
433443
}
434444
catch (Exception e) {
435445
Debug.WriteLine($"{e.Message}", nameof(SetQuery));
@@ -821,19 +831,24 @@ private static void OnEngineSelected(ListViewItemEventArgs args, ref SearchEngin
821831

822832
private async void OnRun()
823833
{
824-
Btn_Run.Enabled = false;
825-
Btn_Cancel.Enabled = true;
826-
Tv_Results.Visible = true;
834+
Btn_Run.Enabled = false;
835+
// Btn_Cancel.Enabled = true;
827836
var text = Tf_Input.Text;
828837

829838
Debug.WriteLine($"Input: {text}", nameof(OnRun));
830839

831840
var ok = await SetQuery(text);
832841
Btn_Cancel.Enabled = ok;
842+
Tv_Results.Visible = ok;
833843

834844
if (!ok) {
835845
return;
836846
}
847+
848+
Pbr_Status.BidirectionalMarquee = false;
849+
Pbr_Status.ProgressBarStyle = ProgressBarStyle.Continuous;
850+
Pbr_Status.Fraction = 0;
851+
Pbr_Status.SetNeedsDisplay();
837852

838853
var sw = Stopwatch.StartNew();
839854

0 commit comments

Comments
 (0)