@@ -35,13 +35,19 @@ private void OnPropertyChanged(string propertyName)
3535 #endregion
3636
3737 #region Variables
38+ MetroDialogSettings dialogSettings = new MetroDialogSettings ( ) ;
39+
3840 NotifyIcon notifyIcon ;
3941
4042 private bool _isLoading = true ;
4143
4244 private bool _isInTray ;
4345 private bool _closeApplication ;
4446
47+ // Indicates a restart message, when settings changed
48+ private string _cultureCode ;
49+ private bool ? _developerMode ;
50+
4551 private bool _applicationView_Expand ;
4652 public bool ApplicationView_Expand
4753 {
@@ -191,7 +197,7 @@ public bool SearchNothingFound
191197 OnPropertyChanged ( "SearchNothingFound" ) ;
192198 }
193199 }
194-
200+
195201 private string _version ;
196202 public string Version
197203 {
@@ -227,6 +233,18 @@ public MainWindow()
227233 // Load appearance
228234 AppearanceManager . Load ( ) ;
229235
236+ if ( SettingsManager . Current . Appearance_EnableTransparency )
237+ {
238+ AllowsTransparency = true ;
239+ Opacity = SettingsManager . Current . Appearance_Opacity ;
240+ }
241+
242+ // Dialog
243+ dialogSettings . CustomResourceDictionary = new ResourceDictionary
244+ {
245+ Source = new Uri ( "NETworkManager;component/Resources/Styles/MetroDialogStyles.xaml" , UriKind . RelativeOrAbsolute )
246+ } ;
247+
230248 // Autostart & Window start
231249 if ( CommandLineManager . Current . Autostart && SettingsManager . Current . Autostart_StartMinimizedInTray || SettingsManager . Current . TrayIcon_AlwaysShowIcon )
232250 InitNotifyIcon ( ) ;
@@ -284,20 +302,13 @@ private async void MetroWindowMain_Closing(object sender, CancelEventArgs e)
284302 {
285303 e . Cancel = true ;
286304
287- MetroDialogSettings dialogSettings = new MetroDialogSettings ( )
288- {
289- CustomResourceDictionary = new ResourceDictionary
290- {
291- Source = new Uri ( "NETworkManager;component/Resources/Styles/MetroDialogStyles.xaml" , UriKind . RelativeOrAbsolute )
292- } ,
293-
294- AffirmativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_Close" ] as string ,
295- NegativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_Cancel" ] as string ,
305+ MetroDialogSettings settings = dialogSettings ;
296306
297- DefaultButtonFocus = MessageDialogResult . Affirmative
298- } ;
307+ settings . AffirmativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_Close" ] as string ;
308+ settings . NegativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_Cancel" ] as string ;
309+ settings . DefaultButtonFocus = MessageDialogResult . Affirmative ;
299310
300- if ( await this . ShowMessageAsync ( System . Windows . Application . Current . Resources [ "String_Header_Confirm" ] as string , System . Windows . Application . Current . Resources [ "String_ConfirmCloseQuesiton" ] as string , MessageDialogStyle . AffirmativeAndNegative , dialogSettings ) == MessageDialogResult . Affirmative )
311+ if ( await this . ShowMessageAsync ( System . Windows . Application . Current . Resources [ "String_Header_Confirm" ] as string , System . Windows . Application . Current . Resources [ "String_ConfirmCloseQuesiton" ] as string , MessageDialogStyle . AffirmativeAndNegative , settings ) == MessageDialogResult . Affirmative )
301312 {
302313 _closeApplication = true ;
303314 Close ( ) ;
@@ -616,6 +627,12 @@ public ICommand OpenSettingsCommand
616627
617628 private async void OpenSettingsAction ( )
618629 {
630+ if ( string . IsNullOrEmpty ( _cultureCode ) )
631+ _cultureCode = SettingsManager . Current . Localization_CultureCode ;
632+
633+ if ( _developerMode == null )
634+ _developerMode = SettingsManager . Current . DeveloperMode ;
635+
619636 SettingsWindow settingsWindow = _isInTray ? new SettingsWindow ( ) : new SettingsWindow ( SelectedApplicationViewInfo . Name ) ;
620637
621638 if ( _isInTray )
@@ -649,30 +666,32 @@ private async void OpenSettingsAction()
649666 }
650667
651668 // Ask the user to restart (if he has changed the language or enables the developer mode)
652- if ( SettingsManager . RestartRequired )
669+ if ( ( _cultureCode != SettingsManager . Current . Localization_CultureCode ) || ( _developerMode != SettingsManager . Current . DeveloperMode ) || ( AllowsTransparency != SettingsManager . Current . Appearance_EnableTransparency ) )
653670 {
654671 ShowWindowAction ( ) ;
655672
656- MetroDialogSettings dialogSettings = new MetroDialogSettings ( )
657- {
658- CustomResourceDictionary = new ResourceDictionary
659- {
660- Source = new Uri ( "NETworkManager;component/Resources/Styles/MetroDialogStyles.xaml" , UriKind . RelativeOrAbsolute )
661- } ,
662-
663- AffirmativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_RestartNow" ] as string ,
664- NegativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_OK" ] as string ,
673+ MetroDialogSettings settings = dialogSettings ;
665674
666- DefaultButtonFocus = MessageDialogResult . Affirmative
667- } ;
675+ settings . AffirmativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_RestartNow" ] as string ;
676+ settings . NegativeButtonText = System . Windows . Application . Current . Resources [ "String_Button_OK" ] as string ;
677+ settings . DefaultButtonFocus = MessageDialogResult . Affirmative ;
668678
669- if ( await this . ShowMessageAsync ( System . Windows . Application . Current . Resources [ "String_RestartRequired" ] as string , System . Windows . Application . Current . Resources [ "String_RestartRequiredAfterSettingsChanged" ] as string , MessageDialogStyle . AffirmativeAndNegative , dialogSettings ) == MessageDialogResult . Affirmative )
679+ if ( await this . ShowMessageAsync ( System . Windows . Application . Current . Resources [ "String_RestartRequired" ] as string , System . Windows . Application . Current . Resources [ "String_RestartRequiredAfterSettingsChanged" ] as string , MessageDialogStyle . AffirmativeAndNegative , settings ) == MessageDialogResult . Affirmative )
670680 {
671681 RestartApplication ( ) ;
672682 return ;
673683 }
674684 }
675685
686+ // Change the transparency
687+ if ( ( AllowsTransparency != SettingsManager . Current . Appearance_EnableTransparency ) || ( Opacity != SettingsManager . Current . Appearance_Opacity ) )
688+ {
689+ if ( ! AllowsTransparency || ! SettingsManager . Current . Appearance_EnableTransparency )
690+ Opacity = 1 ;
691+ else
692+ Opacity = SettingsManager . Current . Appearance_Opacity ;
693+ }
694+
676695 if ( SettingsManager . HotKeysChanged )
677696 {
678697 UnregisterHotKeys ( ) ;
0 commit comments