// Ao sair do windows, manda todas as informações do usuário para o servidor. private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { DataAccess db = new DataAccess(); LogTime.logouttime = DateTime.Now.ToString(); db.SendLog(); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); // Auto save // ... }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); this.isSessionEnding = true; this.Shutdown(); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); MessageBoxResult result = MessageBox.Show("Do you want to save your data?", MainWindow.Title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Yes); }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { Logger logger = logHolder.Logger; logger.Info("User Session Ending"); CleanShutdown(); }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { Log.ErrorLog("程序非正常退出!"); Log.ErrorLog("原因:" + e.ReasonSessionEnding.ToString()); ((MainWindow)Current.MainWindow).SaveTagInfo(); Log.CloseErrorLog(); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); e.Cancel = true; MessageBox.Show("无法关闭程序"); }
/// <inheritdoc/> protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { // Save client settings on logout. Client.Properties.Settings.Default.Save(); base.OnSessionEnding(e); }
/// <summary> /// Check if end of application session should be canceled or not /// (we may have gotten here through unhandled exceptions - so we /// display it and attempt CONTINUE so user can save his data. /// </summary> /// <param name="e"></param> protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); try { if (this.mMainWin != null && this.mOKToClose == true) { if (this.mMainWin.DataContext != null) { e.Cancel = true; logger.Error("The {0} application received an fatal error: {1}.\n\nPlease save your data and re-start manually.", Application.ResourceAssembly.GetName(), e.ReasonSessionEnding.ToString()); Msg.Box.Show(string.Format(CultureInfo.CurrentCulture, "The application received a request to shutdown.\n\n" + "Please save your data and exit manually (click on the link below to report this problem if it persists)."), "Attempt to exit", MsgBoxButtons.OK, MsgBoxImage.Warning, MsgBoxResult.Ok, App.IssueTrackerLink, App.IssueTrackerLink, null, null, true); } } } catch (Exception exp) { logger.Error(exp); } }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { this.log.Info("SessionEnding"); // triggered on windows shutdown or user logoff ShutdownApplication(); }
private async void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e) { try { if (!string.IsNullOrEmpty(Config.LightSettings.Hue.HueApiKey) && !string.IsNullOrEmpty(Config.LightSettings.Hue.HueIpAddress) && !string.IsNullOrEmpty(Config.LightSettings.Hue.SelectedHueLightId)) { await _hueService.SetColor("Off", Config.LightSettings.Hue.SelectedHueLightId).ConfigureAwait(true); } if (Config.LightSettings.LIFX.IsLIFXEnabled && !string.IsNullOrEmpty(Config.LightSettings.LIFX.LIFXApiKey)) { await _lifxService.SetColor("Off", (Selector)Config.LightSettings.LIFX.SelectedLIFXItemId).ConfigureAwait(true); } if (Config.LightSettings.Custom.IsCustomApiEnabled && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffMethod) && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffUri)) { await _customApiService.SetColor("Off", "Off").ConfigureAwait(true); } await _settingsService.SaveSettings(Config).ConfigureAwait(true); } catch (Exception ex) { _diagClient.TrackException(ex); } }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { LogWriter.Write(string.Format( "Due to pending Windows {0}, application will try to save the current settings and presets", e.ReasonSessionEnding.ToString())); GlobalSettings.TrySaveToFile(); try { PresetDataManager.WritePresetDataToFile(); LogWriter.Write("Presets successfully saved"); } catch (Exception ex) { LogWriter.Write("Presets saving failed:"); LogWriter.Write(ex.ToString()); } var splitter = Helpers.SplitterHelper.TryFindSplitter(); if (splitter != null) { splitter.Destroy(); } }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); // Aync: Auto save SaveData(); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); _timer.Dispose(); _timer = null; }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { long startTicks = Log.APPLICATION_END("Enter", Common.LOG_CATEGORY); Log.APPLICATION_END("Exit", Common.LOG_CATEGORY, startTicks); }
/// <summary> /// Raises the <see cref="E:System.Windows.Application.SessionEnding" /> event. /// Occurs when the user ends the Windows session by logging off or shutting down the operating system. /// </summary> /// <param name="e">A <see cref="T:System.Windows.SessionEndingCancelEventArgs" /> that contains the event data.</param> protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); //TODO: Handle OS shutdown here. ; }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { // Cancelling because we can't guarantee proper cleanup of automated LF's // unless the automating application is closed directly. e.Cancel = true; base.OnSessionEnding(e); }
private async void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e) { try { if (!string.IsNullOrEmpty(Config.LightSettings.Hue.HueApiKey) && !string.IsNullOrEmpty(Config.LightSettings.Hue.HueIpAddress) && !string.IsNullOrEmpty(Config.LightSettings.Hue.SelectedHueLightId)) { if (Config.LightSettings.Hue.UseRemoteApi) { await _remoteHueService.SetColor("Off", Config.LightSettings.Hue.SelectedHueLightId, Config.LightSettings.Hue.RemoteBridgeId).ConfigureAwait(true); } else { await _hueService.SetColor("Off", Config.LightSettings.Hue.SelectedHueLightId).ConfigureAwait(true); } } if (Config.LightSettings.LIFX.IsLIFXEnabled && !string.IsNullOrEmpty(Config.LightSettings.LIFX.LIFXApiKey)) { await _lifxService.SetColor("Off", Config.LightSettings.LIFX.SelectedLIFXItemId).ConfigureAwait(true); } if (Config.LightSettings.Custom.IsCustomApiEnabled && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffMethod) && !string.IsNullOrEmpty(Config.LightSettings.Custom.CustomApiOffUri)) { await _customApiService.SetColor("Off", "Off").ConfigureAwait(true); } await _settingsService.SaveSettings(Config).ConfigureAwait(true); } catch (Exception ex) { _logger.LogError(ex, "Error Occured in Current_SessionEnding MainWindow"); _diagClient.TrackException(ex); } }
private void Current_SessionEnding(object sender, SessionEndingCancelEventArgs args) { if (!this.services.GetService <IProjectManager>().CloseSolution(true)) { args.Cancel = true; } }
/// <inheritdoc/> protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { var activeSession = ((ViewModels.Windows.ConnectWizard)(MainWindow as Windows.ConnectWizard)?.DataContext).ConnectionPage.ActiveSession; if (activeSession != null) { // Prevent active session thread from dispatching events to our thread. // Otherwise, Dispatcher.Invoke() and Join() below deadlocks each other. Dispatcher.InvokeShutdown(); // Wait for the active session to terminate gracefully. // We must not return from this method, or allow base.OnSessionEnding() call // *before* the active session is done. Otherwise, the framework would get a // chance (and use it) to kill other threads including active session. activeSession.Thread?.Join(); } base.OnSessionEnding(e); // Save view settings on logout. Views.Properties.Settings.Default.Save(); // Save view model settings on logout. eduVPN.Properties.Settings.Default.Save(); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); e.Cancel = true; Shutdown(); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { // Always call method in base class, so that the event gets raised. base.OnSessionEnding(e); // Place your own SessionEnding logic here OnShutdown(this, null); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { if (global != null) { global.Application_SessionEnding(e); } base.OnSessionEnding(e); }
private void App_OnSessionEnding(Object sender, SessionEndingCancelEventArgs e) { e.Cancel = CancelSessionEnding(); if (!e.Cancel) { Globals.Telemetry.TrackEvent("Exit"); } }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { if (MessageBox.Show(Common.Properties.Resources._query_ExitApplication, Common.Properties.Resources._caption_Confirmation, MessageBoxButton.YesNo) == MessageBoxResult.Yes) IsShutdown = true; else e.Cancel = true; base.OnSessionEnding(e); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { if (MockSettings.OnSessionEnding != null) { MockSettings.OnSessionEnding(this, e); } base.OnSessionEnding(e); }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { // セッション終了時にのみ呼ばれる App.Log("Application_SessionEnding1"); Thread.Sleep(3000); App.Log("Application_SessionEnding2"); }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { if (e != null) { e.Cancel = true; } (Current.MainWindow as NewMainWindow)?.CloseWithoutConfirmAction(); }
/// <summary /> protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); DiagnosticsHelper.LogMessage(DiagSeverity.Information, string.Format(CultureInfo.InvariantCulture, "Session Ending: {0}", e.ReasonSessionEnding)); }
private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { String temp = this.tag; this.tag = APPLICATION; this.CurrentFolder("App_SessionEnding", "lifecyclelogs"); this.Console("App_SessionEnding"); this.tag = temp; }
/// <summary> /// OnSessionEnding is called to raise the SessionEnding event. The developer will /// typically override this method if they want to take action when the OS is ending /// a session ( or they may choose to attach an event). This method will be called when /// the user has chosen to either logoff or shutdown. These events are equivalent /// to receiving a WM_QUERYSESSION window event. Windows will send it when user is /// logging out/shutting down. ( See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/wm_queryendsession.asp ). /// By default if this event is not cancelled - Avalon will then call Application.Shutdown. /// </summary> /// <remarks> /// This method follows the .Net programming guideline of having a protected virtual /// method that raises an event, to provide a convenience for developers that subclass /// the event. /// </remarks> /// <param name="e"></param> protected virtual void OnSessionEnding(SessionEndingCancelEventArgs e) { VerifyAccess(); SessionEndingCancelEventHandler handler = (SessionEndingCancelEventHandler)Events[EVENT_SESSIONENDING]; if (handler != null) { handler(this, e); } }