protected override void OnExit(ExitEventArgs e) { // the app is already running if (e.ApplicationExitCode == 300) { SingleApp.CloseAndSwitch(); base.OnExit(e); return; } AtomexApp.Stop(); try { Updater.Stop(); } catch (TimeoutException) { Log.Error("Failed to stop the updater due to timeout"); } // update has been requested if (e.ApplicationExitCode == 101) { try { Updater.RunUpdate(); Log.Information("Update scheduled"); } catch (Exception ex) { Log.Error(ex, "Failed to schedule update"); } } Log.Information("Application shutdown"); SingleApp.Close(); base.OnExit(e); }
void OnExit(object sender, ControlledApplicationLifetimeExitEventArgs e) { Log.Information("Application shutdown"); try { AtomexApp.Stop(); } catch (Exception) { Log.Error("Error stopping Atomex in OnExit"); } }