@@ -57,7 +57,7 @@ public MainWindow(Settings settings, MainViewModel mainVM)
57
57
DataContext = mainVM ;
58
58
_viewModel = mainVM ;
59
59
_settings = settings ;
60
-
60
+
61
61
InitializeComponent ( ) ;
62
62
InitializePosition ( ) ;
63
63
animationSound . Open ( new Uri ( AppDomain . CurrentDomain . BaseDirectory + "Resources\\ open.wav" ) ) ;
@@ -67,7 +67,7 @@ public MainWindow()
67
67
{
68
68
InitializeComponent ( ) ;
69
69
}
70
-
70
+
71
71
private void OnCopy ( object sender , ExecutedRoutedEventArgs e )
72
72
{
73
73
if ( QueryTextBox . SelectionLength == 0 )
@@ -114,6 +114,8 @@ private void OnLoaded(object sender, RoutedEventArgs _)
114
114
switch ( e . PropertyName )
115
115
{
116
116
case nameof ( MainViewModel . MainWindowVisibilityStatus ) :
117
+ {
118
+ Dispatcher . Invoke ( ( ) =>
117
119
{
118
120
if ( _viewModel . MainWindowVisibilityStatus )
119
121
{
@@ -138,35 +140,35 @@ private void OnLoaded(object sender, RoutedEventArgs _)
138
140
isProgressBarStoryboardPaused = false ;
139
141
}
140
142
141
- if ( _settings . UseAnimation )
143
+ if ( _settings . UseAnimation )
142
144
WindowAnimator ( ) ;
143
145
}
144
146
else if ( ! isProgressBarStoryboardPaused )
145
147
{
146
148
_progressBarStoryboard . Stop ( ProgressBar ) ;
147
149
isProgressBarStoryboardPaused = true ;
148
150
}
149
-
150
- break ;
151
- }
151
+ } ) ;
152
+ break ;
153
+ }
152
154
case nameof ( MainViewModel . ProgressBarVisibility ) :
155
+ {
156
+ Dispatcher . Invoke ( ( ) =>
153
157
{
154
- Dispatcher . Invoke ( ( ) =>
158
+ if ( _viewModel . ProgressBarVisibility == Visibility . Hidden && ! isProgressBarStoryboardPaused )
155
159
{
156
- if ( _viewModel . ProgressBarVisibility == Visibility . Hidden && ! isProgressBarStoryboardPaused )
157
- {
158
- _progressBarStoryboard . Stop ( ProgressBar ) ;
159
- isProgressBarStoryboardPaused = true ;
160
- }
161
- else if ( _viewModel . MainWindowVisibilityStatus &&
162
- isProgressBarStoryboardPaused )
163
- {
164
- _progressBarStoryboard . Begin ( ProgressBar , true ) ;
165
- isProgressBarStoryboardPaused = false ;
166
- }
167
- } ) ;
168
- break ;
169
- }
160
+ _progressBarStoryboard . Stop ( ProgressBar ) ;
161
+ isProgressBarStoryboardPaused = true ;
162
+ }
163
+ else if ( _viewModel . MainWindowVisibilityStatus &&
164
+ isProgressBarStoryboardPaused )
165
+ {
166
+ _progressBarStoryboard . Begin ( ProgressBar , true ) ;
167
+ isProgressBarStoryboardPaused = false ;
168
+ }
169
+ } ) ;
170
+ break ;
171
+ }
170
172
case nameof ( MainViewModel . QueryTextCursorMovedToEnd ) :
171
173
if ( _viewModel . QueryTextCursorMovedToEnd )
172
174
{
@@ -249,35 +251,45 @@ private void InitializeNotifyIcon()
249
251
250
252
contextMenu = new ContextMenu ( ) ;
251
253
252
- var openIcon = new FontIcon { Glyph = "\ue71e " } ;
254
+ var openIcon = new FontIcon
255
+ {
256
+ Glyph = "\ue71e "
257
+ } ;
253
258
var open = new MenuItem
254
259
{
255
- Header = InternationalizationManager . Instance . GetTranslation ( "iconTrayOpen" ) + " (" + _settings . Hotkey + ")" ,
256
- Icon = openIcon
260
+ Header = InternationalizationManager . Instance . GetTranslation ( "iconTrayOpen" ) + " (" + _settings . Hotkey + ")" , Icon = openIcon
261
+ } ;
262
+ var gamemodeIcon = new FontIcon
263
+ {
264
+ Glyph = "\ue7fc "
257
265
} ;
258
- var gamemodeIcon = new FontIcon { Glyph = "\ue7fc " } ;
259
266
var gamemode = new MenuItem
260
267
{
261
- Header = InternationalizationManager . Instance . GetTranslation ( "GameMode" ) ,
262
- Icon = gamemodeIcon
268
+ Header = InternationalizationManager . Instance . GetTranslation ( "GameMode" ) , Icon = gamemodeIcon
269
+ } ;
270
+ var positionresetIcon = new FontIcon
271
+ {
272
+ Glyph = "\ue73f "
263
273
} ;
264
- var positionresetIcon = new FontIcon { Glyph = "\ue73f " } ;
265
274
var positionreset = new MenuItem
266
275
{
267
- Header = InternationalizationManager . Instance . GetTranslation ( "PositionReset" ) ,
268
- Icon = positionresetIcon
276
+ Header = InternationalizationManager . Instance . GetTranslation ( "PositionReset" ) , Icon = positionresetIcon
277
+ } ;
278
+ var settingsIcon = new FontIcon
279
+ {
280
+ Glyph = "\ue713 "
269
281
} ;
270
- var settingsIcon = new FontIcon { Glyph = "\ue713 " } ;
271
282
var settings = new MenuItem
272
283
{
273
- Header = InternationalizationManager . Instance . GetTranslation ( "iconTraySettings" ) ,
274
- Icon = settingsIcon
284
+ Header = InternationalizationManager . Instance . GetTranslation ( "iconTraySettings" ) , Icon = settingsIcon
285
+ } ;
286
+ var exitIcon = new FontIcon
287
+ {
288
+ Glyph = "\ue7e8 "
275
289
} ;
276
- var exitIcon = new FontIcon { Glyph = "\ue7e8 " } ;
277
290
var exit = new MenuItem
278
291
{
279
- Header = InternationalizationManager . Instance . GetTranslation ( "iconTrayExit" ) ,
280
- Icon = exitIcon
292
+ Header = InternationalizationManager . Instance . GetTranslation ( "iconTrayExit" ) , Icon = exitIcon
281
293
} ;
282
294
283
295
open . Click += ( o , e ) => _viewModel . ToggleFlowLauncher ( ) ;
@@ -340,15 +352,15 @@ private void ToggleGameMode()
340
352
}
341
353
private async void PositionReset ( )
342
354
{
343
- _viewModel . Show ( ) ;
344
- await Task . Delay ( 300 ) ; // If don't give a time, Positioning will be weird.
345
- Left = HorizonCenter ( ) ;
346
- Top = VerticalCenter ( ) ;
355
+ _viewModel . Show ( ) ;
356
+ await Task . Delay ( 300 ) ; // If don't give a time, Positioning will be weird.
357
+ Left = HorizonCenter ( ) ;
358
+ Top = VerticalCenter ( ) ;
347
359
}
348
360
private void InitProgressbarAnimation ( )
349
361
{
350
362
var da = new DoubleAnimation ( ProgressBar . X2 , ActualWidth + 150 ,
351
- new Duration ( new TimeSpan ( 0 , 0 , 0 , 0 , 1600 ) ) ) ;
363
+ new Duration ( new TimeSpan ( 0 , 0 , 0 , 0 , 1600 ) ) ) ;
352
364
var da1 = new DoubleAnimation ( ProgressBar . X1 , ActualWidth + 50 , new Duration ( new TimeSpan ( 0 , 0 , 0 , 0 , 1600 ) ) ) ;
353
365
Storyboard . SetTargetProperty ( da , new PropertyPath ( "(Line.X2)" ) ) ;
354
366
Storyboard . SetTargetProperty ( da1 , new PropertyPath ( "(Line.X1)" ) ) ;
@@ -390,11 +402,11 @@ public void WindowAnimator()
390
402
} ;
391
403
var IconMotion = new DoubleAnimation
392
404
{
393
- From = 12 ,
394
- To = 0 ,
395
- EasingFunction = easing ,
396
- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
397
- FillBehavior = FillBehavior . Stop
405
+ From = 12 ,
406
+ To = 0 ,
407
+ EasingFunction = easing ,
408
+ Duration = TimeSpan . FromSeconds ( 0.36 ) ,
409
+ FillBehavior = FillBehavior . Stop
398
410
} ;
399
411
400
412
var ClockOpacity = new DoubleAnimation
@@ -466,10 +478,10 @@ private void OnPreviewDragOver(object sender, DragEventArgs e)
466
478
private async void OnContextMenusForSettingsClick ( object sender , RoutedEventArgs e )
467
479
{
468
480
_viewModel . Hide ( ) ;
469
-
470
- if ( _settings . UseAnimation )
481
+
482
+ if ( _settings . UseAnimation )
471
483
await Task . Delay ( 100 ) ;
472
-
484
+
473
485
App . API . OpenSettingDialog ( ) ;
474
486
}
475
487
@@ -487,7 +499,7 @@ private async void OnDeactivated(object sender, EventArgs e)
487
499
// and always after Settings window is closed.
488
500
if ( _settings . UseAnimation )
489
501
await Task . Delay ( 100 ) ;
490
-
502
+
491
503
if ( _settings . HideWhenDeactive )
492
504
{
493
505
_viewModel . Hide ( ) ;
@@ -525,7 +537,7 @@ public void HideStartup()
525
537
_viewModel . Show ( ) ;
526
538
}
527
539
}
528
-
540
+
529
541
public double HorizonCenter ( )
530
542
{
531
543
var screen = Screen . FromPoint ( System . Windows . Forms . Cursor . Position ) ;
@@ -607,9 +619,9 @@ private void OnKeyDown(object sender, KeyEventArgs e)
607
619
&& QueryTextBox . Text . Length > 0
608
620
&& QueryTextBox . CaretIndex == QueryTextBox . Text . Length )
609
621
{
610
- var queryWithoutActionKeyword =
622
+ var queryWithoutActionKeyword =
611
623
QueryBuilder . Build ( QueryTextBox . Text . Trim ( ) , PluginManager . NonGlobalPlugins ) ? . Search ;
612
-
624
+
613
625
if ( FilesFolders . IsLocationPathString ( queryWithoutActionKeyword ) )
614
626
{
615
627
_viewModel . BackspaceCommand . Execute ( null ) ;
@@ -645,7 +657,7 @@ public void InitializeColorScheme()
645
657
646
658
private void QueryTextBox_KeyUp ( object sender , KeyEventArgs e )
647
659
{
648
- if ( _viewModel . QueryText != QueryTextBox . Text )
660
+ if ( _viewModel . QueryText != QueryTextBox . Text )
649
661
{
650
662
BindingExpression be = QueryTextBox . GetBindingExpression ( System . Windows . Controls . TextBox . TextProperty ) ;
651
663
be . UpdateSource ( ) ;
0 commit comments