protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { base.OnClosing(e); try { SaveLayout(); PublicTransport.ApplicationEventBus.PublishWait(new ShutdownEvent()); ExeConfig.Save(); } catch (Exception ex) { if (null == Logger) { return; } Logger.Log(LogLevel.Error, this, ex.ToString()); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Application.Exit" /> event. /// </summary> /// <param name="e">An <see cref="T:System.Windows.ExitEventArgs" /> that contains the event data.</param> protected override void OnExit(ExitEventArgs e) { base.OnExit(e); if (shutdownOnEvent) { return; } if (null == publicTransport) { return; } if (null == publicTransport.ApplicationEventBus) { logger.Log(LogLevel.Error, this, "Cannot find Event bus to notify application shutdown"); return; } publicTransport.ApplicationEventBus.PublishWait(new ShutdownEvent()); ExeConfig.Save(); }
private void OnShutdown(ShutdownEvent shutdownEvent) { shutdownOnEvent = true; Shutdown(); ExeConfig.Save(); }