@@ -28,9 +28,6 @@ namespace Flow.Launcher
28
28
public partial class MainWindow
29
29
{
30
30
#region Private Fields
31
-
32
- private readonly Storyboard _progressBarStoryboard = new Storyboard ( ) ;
33
- private bool isProgressBarStoryboardPaused ;
34
31
private Settings _settings ;
35
32
private NotifyIcon _notifyIcon ;
36
33
private ContextMenu contextMenu ;
@@ -119,39 +116,9 @@ private void OnLoaded(object sender, RoutedEventArgs _)
119
116
_viewModel . LastQuerySelected = true ;
120
117
}
121
118
122
- if ( _viewModel . ProgressBarVisibility == Visibility . Visible && isProgressBarStoryboardPaused )
123
- {
124
- _progressBarStoryboard . Begin ( ProgressBar , true ) ;
125
- isProgressBarStoryboardPaused = false ;
126
- }
127
-
128
119
if ( _settings . UseAnimation )
129
120
WindowAnimator ( ) ;
130
121
}
131
- else if ( ! isProgressBarStoryboardPaused )
132
- {
133
- _progressBarStoryboard . Stop ( ProgressBar ) ;
134
- isProgressBarStoryboardPaused = true ;
135
- }
136
-
137
- break ;
138
- }
139
- case nameof ( MainViewModel . ProgressBarVisibility ) :
140
- {
141
- Dispatcher . Invoke ( ( ) =>
142
- {
143
- if ( _viewModel . ProgressBarVisibility == Visibility . Hidden && ! isProgressBarStoryboardPaused )
144
- {
145
- _progressBarStoryboard . Stop ( ProgressBar ) ;
146
- isProgressBarStoryboardPaused = true ;
147
- }
148
- else if ( _viewModel . MainWindowVisibilityStatus &&
149
- isProgressBarStoryboardPaused )
150
- {
151
- _progressBarStoryboard . Begin ( ProgressBar , true ) ;
152
- isProgressBarStoryboardPaused = false ;
153
- }
154
- } ) ;
155
122
break ;
156
123
}
157
124
case nameof ( MainViewModel . QueryTextCursorMovedToEnd ) :
@@ -291,17 +258,32 @@ private void ToggleGameMode()
291
258
}
292
259
private void InitProgressbarAnimation ( )
293
260
{
294
- var da = new DoubleAnimation ( ProgressBar . X2 , ActualWidth + 150 ,
295
- new Duration ( new TimeSpan ( 0 , 0 , 0 , 0 , 1600 ) ) ) ;
261
+ var progressBarStoryBoard = new Storyboard ( ) ;
262
+
263
+ var da = new DoubleAnimation ( ProgressBar . X2 , ActualWidth + 150 , new Duration ( new TimeSpan ( 0 , 0 , 0 , 0 , 1600 ) ) ) ;
296
264
var da1 = new DoubleAnimation ( ProgressBar . X1 , ActualWidth + 50 , new Duration ( new TimeSpan ( 0 , 0 , 0 , 0 , 1600 ) ) ) ;
297
265
Storyboard . SetTargetProperty ( da , new PropertyPath ( "(Line.X2)" ) ) ;
298
266
Storyboard . SetTargetProperty ( da1 , new PropertyPath ( "(Line.X1)" ) ) ;
299
- _progressBarStoryboard . Children . Add ( da ) ;
300
- _progressBarStoryboard . Children . Add ( da1 ) ;
301
- _progressBarStoryboard . RepeatBehavior = RepeatBehavior . Forever ;
267
+ progressBarStoryBoard . Children . Add ( da ) ;
268
+ progressBarStoryBoard . Children . Add ( da1 ) ;
269
+ progressBarStoryBoard . RepeatBehavior = RepeatBehavior . Forever ;
270
+
271
+ da . Freeze ( ) ;
272
+ da1 . Freeze ( ) ;
273
+
274
+ var beginStoryboard = new BeginStoryboard ( ) ;
275
+ beginStoryboard . Storyboard = progressBarStoryBoard ;
276
+
277
+ var trigger = new Trigger { Property = System . Windows . Shapes . Line . VisibilityProperty , Value = Visibility . Visible } ;
278
+ trigger . EnterActions . Add ( beginStoryboard ) ;
279
+
280
+ var progressStyle = new Style ( typeof ( System . Windows . Shapes . Line ) ) ;
281
+ progressStyle . BasedOn = FindResource ( "PendingLineStyle" ) as Style ;
282
+ progressStyle . Triggers . Add ( trigger ) ;
283
+
284
+ ProgressBar . Style = progressStyle ;
302
285
303
286
_viewModel . ProgressBarVisibility = Visibility . Hidden ;
304
- isProgressBarStoryboardPaused = true ;
305
287
}
306
288
public void WindowAnimator ( )
307
289
{
0 commit comments