From b6778b8a9bb6c45f0e28f1d718d8bcdf0e5b53d6 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Thu, 21 May 2020 08:18:20 -0600 Subject: [PATCH] updated to also demo Activity mode --- UICatalog/Scenarios/Progress.cs | 40 ++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/UICatalog/Scenarios/Progress.cs b/UICatalog/Scenarios/Progress.cs index a8b64309d..082d0590a 100644 --- a/UICatalog/Scenarios/Progress.cs +++ b/UICatalog/Scenarios/Progress.cs @@ -9,14 +9,22 @@ namespace UICatalog { [ScenarioCategory ("Controls")] class Progress : Scenario { - private ProgressBar _progressBar; + private ProgressBar _activityProgressBar; + private ProgressBar _pulseProgressBar; public override void Setup () { Win.Add (new Button ("Start") { X = Pos.Center () - 20, Y = Pos.Center () - 5, Clicked = () => Start () - }); ; + }); + + Win.Add (new Button ("Pulse") { + X = Pos.Center () - 5, + Y = Pos.Center () - 5, + Clicked = () => Pulse () + }); + Win.Add (new Button ("Stop") { X = Pos.Center () + 10, @@ -24,24 +32,44 @@ namespace UICatalog { Clicked = () => Stop() }); - _progressBar = new ProgressBar () { + _activityProgressBar = new ProgressBar () { X = Pos.Center (), // BUGBUG: If you remove the +1 below the control is drawn at top?!?! Y = Pos.Center ()+1, Width = 30, Fraction = 0.25F, }; - Win.Add (_progressBar); + Win.Add (_activityProgressBar); + + _pulseProgressBar = new ProgressBar () { + X = Pos.Center (), + // BUGBUG: If you remove the +1 below the control is drawn at top?!?! + Y = Pos.Center () + 3, + Width = 30, + }; + Win.Add (_pulseProgressBar); + } + + private void Pulse () + { + if (_activityProgressBar.Fraction + 0.1F >= 1) { + _activityProgressBar.Fraction = 0F; + } else { + _activityProgressBar.Fraction += 0.1F; + } + _pulseProgressBar.Pulse (); } private void Start () { - _progressBar.Fraction = 0F; + _activityProgressBar.Fraction = 0F; + _pulseProgressBar.Fraction = 0F; } private void Stop () { - _progressBar.Fraction = 1F; + _activityProgressBar.Fraction = 1F; + _pulseProgressBar.Fraction = 1F; } } } \ No newline at end of file