@@ -57,7 +57,7 @@ public MainWindow(Settings settings, MainViewModel mainVM)
5757 DataContext = mainVM ;
5858 _viewModel = mainVM ;
5959 _settings = settings ;
60-
60+
6161 InitializeComponent ( ) ;
6262 InitializePosition ( ) ;
6363 animationSound . Open ( new Uri ( AppDomain . CurrentDomain . BaseDirectory + "Resources\\ open.wav" ) ) ;
@@ -67,7 +67,7 @@ public MainWindow()
6767 {
6868 InitializeComponent ( ) ;
6969 }
70-
70+
7171 private void OnCopy ( object sender , ExecutedRoutedEventArgs e )
7272 {
7373 if ( QueryTextBox . SelectionLength == 0 )
@@ -114,6 +114,8 @@ private void OnLoaded(object sender, RoutedEventArgs _)
114114 switch ( e . PropertyName )
115115 {
116116 case nameof ( MainViewModel . MainWindowVisibilityStatus ) :
117+ {
118+ Dispatcher . Invoke ( ( ) =>
117119 {
118120 if ( _viewModel . MainWindowVisibilityStatus )
119121 {
@@ -138,35 +140,35 @@ private void OnLoaded(object sender, RoutedEventArgs _)
138140 isProgressBarStoryboardPaused = false ;
139141 }
140142
141- if ( _settings . UseAnimation )
143+ if ( _settings . UseAnimation )
142144 WindowAnimator ( ) ;
143145 }
144146 else if ( ! isProgressBarStoryboardPaused )
145147 {
146148 _progressBarStoryboard . Stop ( ProgressBar ) ;
147149 isProgressBarStoryboardPaused = true ;
148150 }
149-
150- break ;
151- }
151+ } ) ;
152+ break ;
153+ }
152154 case nameof ( MainViewModel . ProgressBarVisibility ) :
155+ {
156+ Dispatcher . Invoke ( ( ) =>
153157 {
154- Dispatcher . Invoke ( ( ) =>
158+ if ( _viewModel . ProgressBarVisibility == Visibility . Hidden && ! isProgressBarStoryboardPaused )
155159 {
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+ }
170172 case nameof ( MainViewModel . QueryTextCursorMovedToEnd ) :
171173 if ( _viewModel . QueryTextCursorMovedToEnd )
172174 {
@@ -249,35 +251,45 @@ private void InitializeNotifyIcon()
249251
250252 contextMenu = new ContextMenu ( ) ;
251253
252- var openIcon = new FontIcon { Glyph = "\ue71e " } ;
254+ var openIcon = new FontIcon
255+ {
256+ Glyph = "\ue71e "
257+ } ;
253258 var open = new MenuItem
254259 {
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 "
257265 } ;
258- var gamemodeIcon = new FontIcon { Glyph = "\ue7fc " } ;
259266 var gamemode = new MenuItem
260267 {
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 "
263273 } ;
264- var positionresetIcon = new FontIcon { Glyph = "\ue73f " } ;
265274 var positionreset = new MenuItem
266275 {
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 "
269281 } ;
270- var settingsIcon = new FontIcon { Glyph = "\ue713 " } ;
271282 var settings = new MenuItem
272283 {
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 "
275289 } ;
276- var exitIcon = new FontIcon { Glyph = "\ue7e8 " } ;
277290 var exit = new MenuItem
278291 {
279- Header = InternationalizationManager . Instance . GetTranslation ( "iconTrayExit" ) ,
280- Icon = exitIcon
292+ Header = InternationalizationManager . Instance . GetTranslation ( "iconTrayExit" ) , Icon = exitIcon
281293 } ;
282294
283295 open . Click += ( o , e ) => _viewModel . ToggleFlowLauncher ( ) ;
@@ -340,15 +352,15 @@ private void ToggleGameMode()
340352 }
341353 private async void PositionReset ( )
342354 {
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 ( ) ;
347359 }
348360 private void InitProgressbarAnimation ( )
349361 {
350362 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 ) ) ) ;
352364 var da1 = new DoubleAnimation ( ProgressBar . X1 , ActualWidth + 50 , new Duration ( new TimeSpan ( 0 , 0 , 0 , 0 , 1600 ) ) ) ;
353365 Storyboard . SetTargetProperty ( da , new PropertyPath ( "(Line.X2)" ) ) ;
354366 Storyboard . SetTargetProperty ( da1 , new PropertyPath ( "(Line.X1)" ) ) ;
@@ -390,11 +402,11 @@ public void WindowAnimator()
390402 } ;
391403 var IconMotion = new DoubleAnimation
392404 {
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
398410 } ;
399411
400412 var ClockOpacity = new DoubleAnimation
@@ -466,10 +478,10 @@ private void OnPreviewDragOver(object sender, DragEventArgs e)
466478 private async void OnContextMenusForSettingsClick ( object sender , RoutedEventArgs e )
467479 {
468480 _viewModel . Hide ( ) ;
469-
470- if ( _settings . UseAnimation )
481+
482+ if ( _settings . UseAnimation )
471483 await Task . Delay ( 100 ) ;
472-
484+
473485 App . API . OpenSettingDialog ( ) ;
474486 }
475487
@@ -487,7 +499,7 @@ private async void OnDeactivated(object sender, EventArgs e)
487499 // and always after Settings window is closed.
488500 if ( _settings . UseAnimation )
489501 await Task . Delay ( 100 ) ;
490-
502+
491503 if ( _settings . HideWhenDeactive )
492504 {
493505 _viewModel . Hide ( ) ;
@@ -525,7 +537,7 @@ public void HideStartup()
525537 _viewModel . Show ( ) ;
526538 }
527539 }
528-
540+
529541 public double HorizonCenter ( )
530542 {
531543 var screen = Screen . FromPoint ( System . Windows . Forms . Cursor . Position ) ;
@@ -607,9 +619,9 @@ private void OnKeyDown(object sender, KeyEventArgs e)
607619 && QueryTextBox . Text . Length > 0
608620 && QueryTextBox . CaretIndex == QueryTextBox . Text . Length )
609621 {
610- var queryWithoutActionKeyword =
622+ var queryWithoutActionKeyword =
611623 QueryBuilder . Build ( QueryTextBox . Text . Trim ( ) , PluginManager . NonGlobalPlugins ) ? . Search ;
612-
624+
613625 if ( FilesFolders . IsLocationPathString ( queryWithoutActionKeyword ) )
614626 {
615627 _viewModel . BackspaceCommand . Execute ( null ) ;
@@ -645,7 +657,7 @@ public void InitializeColorScheme()
645657
646658 private void QueryTextBox_KeyUp ( object sender , KeyEventArgs e )
647659 {
648- if ( _viewModel . QueryText != QueryTextBox . Text )
660+ if ( _viewModel . QueryText != QueryTextBox . Text )
649661 {
650662 BindingExpression be = QueryTextBox . GetBindingExpression ( System . Windows . Controls . TextBox . TextProperty ) ;
651663 be . UpdateSource ( ) ;
0 commit comments