private void Application_Exit(object sender, ExitEventArgs e) { if (_serviceManager != null) { _serviceManager.Dispose(); _serviceManager = null; } }
private void Application_Startup(object sender, StartupEventArgs e) { var serviceManager = new ServiceManager(); if (!serviceManager.Startup(e.Args)) { serviceManager.Dispose(); serviceManager = null; this.Shutdown(); } else { this.StartupUri = new Uri("Windows/MainWindow.xaml", UriKind.Relative); _serviceManager = serviceManager; } }