From 1f00341ffbf1af6be02bba9a02b638cba34d66a8 Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 29 May 2026 09:35:28 +0200 Subject: [PATCH 1/8] Replace new style creation and trigger use with visibility event handler in InitProgressbarAnimation This avoids the creation of a new style - so the problematic brush stroke with its SystemAccentColour resource in PendingLineStyle is not cloned --- Flow.Launcher/MainWindow.xaml.cs | 49 ++++++++++++++------------------ 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 70273d616c3..ae31b9db33e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -75,6 +75,7 @@ public partial class MainWindow : IDisposable // Window Animation private const double DefaultRightMargin = 66; //* this value from base.xaml private bool _isClockPanelAnimating = false; + private Storyboard _progressBarStoryboard; // IDisposable private bool _disposed = false; @@ -1120,7 +1121,7 @@ private double VerticalTop(MonitorInfo screen) private void InitProgressbarAnimation() { - var progressBarStoryBoard = new Storyboard(); + _progressBarStoryboard = new Storyboard(); var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600))); @@ -1128,41 +1129,35 @@ private void InitProgressbarAnimation() new Duration(new TimeSpan(0, 0, 0, 0, 1600))); Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)")); Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)")); - progressBarStoryBoard.Children.Add(da); - progressBarStoryBoard.Children.Add(da1); - progressBarStoryBoard.RepeatBehavior = RepeatBehavior.Forever; + _progressBarStoryboard.Children.Add(da); + _progressBarStoryboard.Children.Add(da1); + _progressBarStoryboard.RepeatBehavior = RepeatBehavior.Forever; da.Freeze(); da1.Freeze(); - const string progressBarAnimationName = "ProgressBarAnimation"; - var beginStoryboard = new BeginStoryboard - { - Name = progressBarAnimationName, Storyboard = progressBarStoryBoard - }; + ProgressBar.SetResourceReference(StyleProperty, "PendingLineStyle"); + ProgressBar.IsVisibleChanged -= ProgressBar_IsVisibleChanged; + ProgressBar.IsVisibleChanged += ProgressBar_IsVisibleChanged; - var stopStoryboard = new StopStoryboard() - { - BeginStoryboardName = progressBarAnimationName - }; + _viewModel.ProgressBarVisibility = Visibility.Hidden; + } - var trigger = new Trigger + private void ProgressBar_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (_progressBarStoryboard == null) { - Property = VisibilityProperty, Value = Visibility.Visible - }; - trigger.EnterActions.Add(beginStoryboard); - trigger.ExitActions.Add(stopStoryboard); + return; + } - var progressStyle = new Style(typeof(Line)) + if (ProgressBar.Visibility == Visibility.Visible) { - BasedOn = FindResource("PendingLineStyle") as Style - }; - progressStyle.RegisterName(progressBarAnimationName, beginStoryboard); - progressStyle.Triggers.Add(trigger); - - ProgressBar.Style = progressStyle; - - _viewModel.ProgressBarVisibility = Visibility.Hidden; + _progressBarStoryboard.Begin(ProgressBar, true); + } + else + { + _progressBarStoryboard.Stop(ProgressBar); + } } private void WindowAnimation() From c18899d96583e0a2f52997fe0fca152aada781b7 Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 29 May 2026 09:36:04 +0200 Subject: [PATCH 2/8] Make storyboard target explicit for the double animations in InitProgressbarAnimation --- Flow.Launcher/MainWindow.xaml.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index ae31b9db33e..c4e946d561d 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1127,7 +1127,9 @@ private void InitProgressbarAnimation() new Duration(new TimeSpan(0, 0, 0, 0, 1600))); var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth + 0, new Duration(new TimeSpan(0, 0, 0, 0, 1600))); + Storyboard.SetTarget(da, ProgressBar); Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)")); + Storyboard.SetTarget(da1, ProgressBar); Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)")); _progressBarStoryboard.Children.Add(da); _progressBarStoryboard.Children.Add(da1); From a8e3d9ada1e10fcdb9b504306c16e4844badba7c Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 29 May 2026 10:05:48 +0200 Subject: [PATCH 3/8] Refactor InitProgressbarAnimation to use clearer named variables --- Flow.Launcher/MainWindow.xaml.cs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index c4e946d561d..13be1d52a5f 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1123,20 +1123,24 @@ private void InitProgressbarAnimation() { _progressBarStoryboard = new Storyboard(); - var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, - new Duration(new TimeSpan(0, 0, 0, 0, 1600))); - var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth + 0, - new Duration(new TimeSpan(0, 0, 0, 0, 1600))); - Storyboard.SetTarget(da, ProgressBar); - Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)")); - Storyboard.SetTarget(da1, ProgressBar); - Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)")); - _progressBarStoryboard.Children.Add(da); - _progressBarStoryboard.Children.Add(da1); + var animationDuration = new Duration(TimeSpan.FromMilliseconds(1600)); + var progressBarLength = 100; + + var lineEndAnimation = new DoubleAnimation(ProgressBar.X2, ActualWidth + progressBarLength, animationDuration); + var lineStartAnimation = new DoubleAnimation(ProgressBar.X1, ActualWidth, animationDuration); + + Storyboard.SetTarget(lineEndAnimation, ProgressBar); + Storyboard.SetTargetProperty(lineEndAnimation, new PropertyPath("(Line.X2)")); + + Storyboard.SetTarget(lineStartAnimation, ProgressBar); + Storyboard.SetTargetProperty(lineStartAnimation, new PropertyPath("(Line.X1)")); + + _progressBarStoryboard.Children.Add(lineEndAnimation); + _progressBarStoryboard.Children.Add(lineStartAnimation); _progressBarStoryboard.RepeatBehavior = RepeatBehavior.Forever; - da.Freeze(); - da1.Freeze(); + lineEndAnimation.Freeze(); + lineStartAnimation.Freeze(); ProgressBar.SetResourceReference(StyleProperty, "PendingLineStyle"); ProgressBar.IsVisibleChanged -= ProgressBar_IsVisibleChanged; From 2c16f30ca500bc83d87741a12784ec19dd0dcac4 Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 29 May 2026 10:10:22 +0200 Subject: [PATCH 4/8] Calculate progress bar length dynamically using xaml values instead of hardcoding it in InitProgressbarAnimation --- Flow.Launcher/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 13be1d52a5f..8bf4c019f02 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1124,7 +1124,7 @@ private void InitProgressbarAnimation() _progressBarStoryboard = new Storyboard(); var animationDuration = new Duration(TimeSpan.FromMilliseconds(1600)); - var progressBarLength = 100; + var progressBarLength = ProgressBar.X2 - ProgressBar.X1; var lineEndAnimation = new DoubleAnimation(ProgressBar.X2, ActualWidth + progressBarLength, animationDuration); var lineStartAnimation = new DoubleAnimation(ProgressBar.X1, ActualWidth, animationDuration); From bc4e254165af7328294bc62b534f6f724e8e8304 Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 29 May 2026 10:20:20 +0200 Subject: [PATCH 5/8] Move progress bar style declaration from InitProgressbarAnimation to xaml --- Flow.Launcher/MainWindow.xaml | 1 + Flow.Launcher/MainWindow.xaml.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 9d6b51dccd8..2950d2f6555 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -337,6 +337,7 @@ Date: Fri, 29 May 2026 10:34:13 +0200 Subject: [PATCH 6/8] Refactor InitProgressbarAnimation to use object initializer for animations Clearer and more consistent with how its done elsewhere in the file. --- Flow.Launcher/MainWindow.xaml.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 839fd7de90f..8b3aeb30ee5 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1126,8 +1126,18 @@ private void InitProgressbarAnimation() var animationDuration = new Duration(TimeSpan.FromMilliseconds(1600)); var progressBarLength = ProgressBar.X2 - ProgressBar.X1; - var lineEndAnimation = new DoubleAnimation(ProgressBar.X2, ActualWidth + progressBarLength, animationDuration); - var lineStartAnimation = new DoubleAnimation(ProgressBar.X1, ActualWidth, animationDuration); + var lineEndAnimation = new DoubleAnimation + { + From = ProgressBar.X2, + To = ActualWidth + progressBarLength, + Duration = animationDuration + }; + var lineStartAnimation = new DoubleAnimation + { + From = ProgressBar.X1, + To = ActualWidth, + Duration = animationDuration + }; Storyboard.SetTarget(lineEndAnimation, ProgressBar); Storyboard.SetTargetProperty(lineEndAnimation, new PropertyPath("(Line.X2)")); From 779026c5864ab3373af016328cb0dcfb4732a8d1 Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 29 May 2026 12:54:00 +0200 Subject: [PATCH 7/8] Use ProgressBar ActualWidth instead of the window's ActualWidth for animations in InitProgressbarAnimation --- Flow.Launcher/MainWindow.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 8b3aeb30ee5..20ff15f9fe7 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1129,13 +1129,13 @@ private void InitProgressbarAnimation() var lineEndAnimation = new DoubleAnimation { From = ProgressBar.X2, - To = ActualWidth + progressBarLength, + To = ProgressBar.ActualWidth + progressBarLength, Duration = animationDuration }; var lineStartAnimation = new DoubleAnimation { From = ProgressBar.X1, - To = ActualWidth, + To = ProgressBar.ActualWidth, Duration = animationDuration }; From 238162a365afc2add330c1d214aff95d79b8f3cc Mon Sep 17 00:00:00 2001 From: David Brett <91752438+DavidGBrett@users.noreply.github.com> Date: Fri, 29 May 2026 14:48:15 +0200 Subject: [PATCH 8/8] Check ProgressBar visibility using .IsVisible instead of .Visibility Calculated version that waits for true visibility Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- Flow.Launcher/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 20ff15f9fe7..4866c0deae6 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1165,7 +1165,7 @@ private void ProgressBar_IsVisibleChanged(object sender, DependencyPropertyChang return; } - if (ProgressBar.Visibility == Visibility.Visible) + if (ProgressBar.IsVisible) { _progressBarStoryboard.Begin(ProgressBar, true); }