From 30f830e22decd4f445da3797a18ebdfc778e7c81 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 27 Mar 2023 20:53:48 +0100 Subject: [PATCH] Make SpinnerView show/hide instead of stopping --- UICatalog/Scenarios/Progress.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/UICatalog/Scenarios/Progress.cs b/UICatalog/Scenarios/Progress.cs index 94f278e71..9c809f23e 100644 --- a/UICatalog/Scenarios/Progress.cs +++ b/UICatalog/Scenarios/Progress.cs @@ -79,7 +79,7 @@ namespace UICatalog.Scenarios { ActivityProgressBar = new ProgressBar () { X = Pos.Right (LeftFrame) + 1, Y = Pos.Bottom (startButton) + 1, - Width = Dim.Fill (1), + Width = Dim.Fill (), Height = 1, Fraction = 0.25F, ColorScheme = Colors.Error @@ -88,7 +88,9 @@ namespace UICatalog.Scenarios { Spinner = new SpinnerView { X = Pos.Right (ActivityProgressBar), - Y = ActivityProgressBar.Y + Y = ActivityProgressBar.Y, + Visible = false, + }; Add (Spinner); @@ -117,12 +119,23 @@ namespace UICatalog.Scenarios { { Started = true; StartBtnClick?.Invoke (); + Application.MainLoop.Invoke(()=>{ + Spinner.Visible = true; + ActivityProgressBar.Width = Dim.Fill(1); + this.LayoutSubviews(); + }); } internal void Stop () { Started = false; StopBtnClick?.Invoke (); + + Application.MainLoop.Invoke(()=>{ + Spinner.Visible = false; + ActivityProgressBar.Width = Dim.Fill(); + this.LayoutSubviews(); + }); } internal void Pulse ()