@@ -42,7 +42,6 @@ private void OnPropertyChanged(string propertyName)
4242 private bool _isLoading = true ;
4343
4444 private bool _isInTray ;
45- private bool _restartApplication ;
4645 private bool _closeApplication ;
4746
4847 // Indicates a restart message, when settings changed
@@ -220,15 +219,6 @@ public MainWindow()
220219 InitializeComponent ( ) ;
221220 DataContext = this ;
222221
223- // Parse the command line arguments and store them in the current configuration
224- CommandLineManager . Parse ( ) ;
225-
226- // Detect the current configuration
227- ConfigurationManager . Detect ( ) ;
228-
229- // Load settings
230- SettingsManager . Load ( ) ;
231-
232222 // Get assembly informations
233223 AssemblyManager . Load ( ) ;
234224 Version = AssemblyManager . Current . AssemblyVersion . ToString ( ) ;
@@ -269,10 +259,6 @@ public MainWindow()
269259 // Load settings
270260 ApplicationView_Expand = SettingsManager . Current . ApplicationView_Expand ;
271261
272- // Load templates
273- TemplateManager . LoadNetworkInterfaceConfigTemplates ( ) ;
274- TemplateManager . LoadWakeOnLANTemplates ( ) ;
275-
276262 _isLoading = false ;
277263 }
278264
@@ -295,7 +281,7 @@ private void LoadApplicationList()
295281 private async void MetroWindowMain_Closing ( object sender , CancelEventArgs e )
296282 {
297283 // Hide the application to tray
298- if ( ! _closeApplication && ! _restartApplication && SettingsManager . Current . Window_MinimizeInsteadOfTerminating )
284+ if ( ! _closeApplication && SettingsManager . Current . Window_MinimizeInsteadOfTerminating )
299285 {
300286 e . Cancel = true ;
301287
@@ -305,7 +291,7 @@ private async void MetroWindowMain_Closing(object sender, CancelEventArgs e)
305291 }
306292
307293 // Confirm close
308- if ( ! _closeApplication && ! _restartApplication && SettingsManager . Current . Window_ConfirmClose )
294+ if ( ! _closeApplication && SettingsManager . Current . Window_ConfirmClose )
309295 {
310296 e . Cancel = true ;
311297
@@ -324,9 +310,6 @@ private async void MetroWindowMain_Closing(object sender, CancelEventArgs e)
324310 return ;
325311 }
326312
327- if ( ! _restartApplication && ! ImportExportManager . ForceRestart )
328- SaveTemplatesAndSettings ( ) ;
329-
330313 // Unregister HotKeys
331314 if ( RegisteredHotKeys . Count > 0 )
332315 UnregisterHotKeys ( ) ;
@@ -335,20 +318,6 @@ private async void MetroWindowMain_Closing(object sender, CancelEventArgs e)
335318 if ( notifyIcon != null )
336319 notifyIcon . Dispose ( ) ;
337320 }
338-
339- private void SaveTemplatesAndSettings ( )
340- {
341- // Save templates
342- if ( TemplateManager . NetworkInterfaceConfigTemplatesChanged )
343- TemplateManager . SaveNetworkInterfaceConfigTemplates ( ) ;
344-
345- if ( TemplateManager . WakeOnLANTemplatesChanged )
346- TemplateManager . SaveWakeOnLANTemplates ( ) ;
347-
348- // Save settings
349- if ( SettingsManager . Current . SettingsChanged )
350- SettingsManager . Save ( ) ;
351- }
352321 #endregion
353322
354323 #region Application Views
@@ -740,11 +709,16 @@ private void CloseApplicationAction()
740709
741710 private void RestartApplication ( )
742711 {
743- SaveTemplatesAndSettings ( ) ;
744-
745- Process . Start ( ConfigurationManager . Current . ApplicationFullName ) ;
712+ new Process
713+ {
714+ StartInfo =
715+ {
716+ FileName = ConfigurationManager . Current . ApplicationFullName ,
717+ Arguments = string . Format ( "--restart-pid:{0}" , Process . GetCurrentProcess ( ) . Id )
718+ }
719+ } . Start ( ) ;
746720
747- _restartApplication = true ;
721+ _closeApplication = true ;
748722 Close ( ) ;
749723 }
750724
0 commit comments