@@ -140,7 +140,8 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
140
140
_viewModel . Show ( ) ;
141
141
}
142
142
143
- // Show notify icon when flowlauncher is hidden
143
+ // Initialize context menu & notify icon
144
+ InitializeContextMenu ( ) ;
144
145
InitializeNotifyIcon ( ) ;
145
146
146
147
// Initialize color scheme
@@ -270,6 +271,9 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
270
271
case nameof ( Settings . KeepMaxResults ) :
271
272
SetupResizeMode ( ) ;
272
273
break ;
274
+ case nameof ( Settings . SettingWindowFont ) :
275
+ InitializeContextMenu ( ) ;
276
+ break ;
273
277
}
274
278
} ;
275
279
@@ -563,6 +567,44 @@ private void InitializeNotifyIcon()
563
567
Icon = Constant . Version == "1.0.0" ? Properties . Resources . dev : Properties . Resources . app ,
564
568
Visible = ! _settings . HideNotifyIcon
565
569
} ;
570
+
571
+ _notifyIcon . MouseClick += ( o , e ) =>
572
+ {
573
+ switch ( e . Button )
574
+ {
575
+ case MouseButtons . Left :
576
+ _viewModel . ToggleFlowLauncher ( ) ;
577
+ break ;
578
+ case MouseButtons . Right :
579
+
580
+ _contextMenu . IsOpen = true ;
581
+ // Get context menu handle and bring it to the foreground
582
+ if ( PresentationSource . FromVisual ( _contextMenu ) is HwndSource hwndSource )
583
+ {
584
+ Win32Helper . SetForegroundWindow ( hwndSource . Handle ) ;
585
+ }
586
+
587
+ _contextMenu . Focus ( ) ;
588
+ break ;
589
+ }
590
+ } ;
591
+ }
592
+
593
+ private void UpdateNotifyIconText ( )
594
+ {
595
+ var menu = _contextMenu ;
596
+ ( ( MenuItem ) menu . Items [ 0 ] ) . Header = App . API . GetTranslation ( "iconTrayOpen" ) +
597
+ " (" + _settings . Hotkey + ")" ;
598
+ ( ( MenuItem ) menu . Items [ 1 ] ) . Header = App . API . GetTranslation ( "GameMode" ) ;
599
+ ( ( MenuItem ) menu . Items [ 2 ] ) . Header = App . API . GetTranslation ( "PositionReset" ) ;
600
+ ( ( MenuItem ) menu . Items [ 3 ] ) . Header = App . API . GetTranslation ( "iconTraySettings" ) ;
601
+ ( ( MenuItem ) menu . Items [ 4 ] ) . Header = App . API . GetTranslation ( "iconTrayExit" ) ;
602
+ }
603
+
604
+ private void InitializeContextMenu ( )
605
+ {
606
+ var menu = _contextMenu ;
607
+ menu . Items . Clear ( ) ;
566
608
var openIcon = new FontIcon { Glyph = "\ue71e " } ;
567
609
var open = new MenuItem
568
610
{
@@ -608,38 +650,6 @@ private void InitializeNotifyIcon()
608
650
_contextMenu . Items . Add ( positionreset ) ;
609
651
_contextMenu . Items . Add ( settings ) ;
610
652
_contextMenu . Items . Add ( exit ) ;
611
-
612
- _notifyIcon . MouseClick += ( o , e ) =>
613
- {
614
- switch ( e . Button )
615
- {
616
- case MouseButtons . Left :
617
- _viewModel . ToggleFlowLauncher ( ) ;
618
- break ;
619
- case MouseButtons . Right :
620
-
621
- _contextMenu . IsOpen = true ;
622
- // Get context menu handle and bring it to the foreground
623
- if ( PresentationSource . FromVisual ( _contextMenu ) is HwndSource hwndSource )
624
- {
625
- Win32Helper . SetForegroundWindow ( hwndSource . Handle ) ;
626
- }
627
-
628
- _contextMenu . Focus ( ) ;
629
- break ;
630
- }
631
- } ;
632
- }
633
-
634
- private void UpdateNotifyIconText ( )
635
- {
636
- var menu = _contextMenu ;
637
- ( ( MenuItem ) menu . Items [ 0 ] ) . Header = App . API . GetTranslation ( "iconTrayOpen" ) +
638
- " (" + _settings . Hotkey + ")" ;
639
- ( ( MenuItem ) menu . Items [ 1 ] ) . Header = App . API . GetTranslation ( "GameMode" ) ;
640
- ( ( MenuItem ) menu . Items [ 2 ] ) . Header = App . API . GetTranslation ( "PositionReset" ) ;
641
- ( ( MenuItem ) menu . Items [ 3 ] ) . Header = App . API . GetTranslation ( "iconTraySettings" ) ;
642
- ( ( MenuItem ) menu . Items [ 4 ] ) . Header = App . API . GetTranslation ( "iconTrayExit" ) ;
643
653
}
644
654
645
655
#endregion
0 commit comments