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); }
protected virtual void OnSessionEnding(SessionEndingCancelEventArgs args) { if (SessionEnding != null) { SessionEnding(this, args); } }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); MessageBoxResult result = MessageBox.Show("您想要保存数据吗?", MainWindow.Title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question, defaultResult: MessageBoxResult.Cancel); e.Cancel = (result == MessageBoxResult.Cancel); }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { string msg = string.Format("{0}.End sessinon?", e.ReasonSessionEnding); MessageBoxResult rs = MessageBox.Show(msg, "Seesion Ending", MessageBoxButton.YesNo); if (rs == MessageBoxResult.No) { e.Cancel = true; } }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { if(MainWindow != null) { (MainWindow as MainWindow).Application_SessionEnding(sender, e); } }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { if (!ServiceLocator.I.GetInstance<IApplicationService>().IsWorking) return; if (UIHelper.Confirm(e.ReasonSessionEnding + " while application is casting?", "Appcasting")) { e.Cancel = true; } }
private void ApplicationSessionEnding(object sender,SessionEndingCancelEventArgs e) { MainWindow wnd; if(this.MainWindow!=null) { wnd=this.MainWindow as MainWindow; wnd.SessionEnd=true; } }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); if (UnsavedData) { e.Cancel = true; MessageBox.Show("The application attempted to close as a result of " + e.ReasonSessionEnding.ToString() + ". This is not allowed, as you have unsaved data."); } }
/// <summary> /// Event handler. Called by App for session ending events. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">Session ending cancel event information.</param> private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { // Ask the user if they want to allow the session to end string msg = string.Format( "{0}. Are you sure you wish to log off/shutdown? This will stop the (interactive) Jenkins Slave on this machine and you will need to log in again to restart it.", e.ReasonSessionEnding); if (Interaction.ConfirmStopJenkinsSlave(msg) == false) { e.Cancel = true; } }
//Occurs when the user ends the Windows session by logging off or shutting down the operating system void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { // Ask the user if they want to allow the session to end string msg = string.Format("{0}. End session?", e.ReasonSessionEnding); MessageBoxResult result = MessageBox.Show(msg, "Session Ending", MessageBoxButton.YesNo); // End session, if specified if (result == MessageBoxResult.No) { // e.Cancel = true; } //writte all data to the mysql }
// UNDONE: Check exit from ImageViewer ? private void ApplicationOnSessionEnding(object sender, SessionEndingCancelEventArgs e) { var result = MessageBoxResult.Yes; // Если мы что-то делаем if (_fileSystem.IsOperationActive) { result = MessageBox.Show( "Внимание, активны несколько фоновых процессов.\n\nВы настаиваете на завершении?", "Unreality Commander - Подсистема защиты", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, result ); //if (result == MessageBoxResult.OK) // _fileSystem.TerminateAllJobs(); } e.Cancel = (result == MessageBoxResult.Yes); }
private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { if (!_isSaved) { lock (_syncLock) { if (!_isSaved) { Settings.Save(); _isSaved = true; } } } }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); log.Info("App.OnSessionEnding"); }
private bool WmQueryEndSession(IntPtr lParam, ref IntPtr refInt) { int reason = NativeMethods.IntPtrToInt32(lParam); bool retVal = false; // Event handler exception continuality: if exception occurs in SessionEnding event handlers, our state would not // be corrupted because no internal state are affected by SessionEnding. Please check Event handler exception continuality // if a state depending on this event is added. SessionEndingCancelEventArgs secEventArgs = new SessionEndingCancelEventArgs( (reason & NativeMethods.ENDSESSION_LOGOFF) != 0? ReasonSessionEnding.Logoff : ReasonSessionEnding.Shutdown ); OnSessionEnding( secEventArgs ); // shut down the app if not cancelled if ( secEventArgs.Cancel == false ) { Shutdown(); // return true to the wnd proc to signal that we can terminate properly refInt = new IntPtr(1); retVal = false; } else { // <SecurityNote> // This'll stop a user from Logging off and hence is a high trust operation. // Demand high level of trust. // </SecurityNote> SecurityHelper.DemandUnmanagedCode(); refInt = IntPtr.Zero; // we have handled the event DefWndProc will not be called for this msg retVal = true; } return retVal; }
/// <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); } }
private void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { this.OnExit((ExitEventArgs)null); }
//called when windows shuts down or user logs out private void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e) { Terminate(null); }
/// <summary> /// Ads a firewall exception /// </summary> //private static void AddFirewallException() //{ // try // { // var type = Type.GetTypeFromCLSID(new Guid("{304CE942-6E39-40D8-943A-B913C40C9CD4}")); // var firewallManager = (INetFwMgr)Activator.CreateInstance(type); // type = Type.GetTypeFromProgID("HNetCfg.FwAuthorizedApplication"); // var authapp = (INetFwAuthorizedApplication)Activator.CreateInstance(type); // authapp.Name = "PersonalAnalytics"; // authapp.ProcessImageFileName = Assembly.GetExecutingAssembly().Location; // location of application // authapp.Scope = NET_FW_SCOPE_.NET_FW_SCOPE_ALL; // authapp.IpVersion = NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY; // authapp.Enabled = true; // firewallManager.LocalPolicy.CurrentProfile.AuthorizedApplications.Add(authapp); // } // catch (Exception e) // { // // Known exception if user doesn't run the application as an admin // Logger.WriteToLogFile(e); // } //} /// <summary> /// Application is closed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { TrackerManager.GetInstance().Stop(); }
void App_SessionEnding(object sender, SessionEndingCancelEventArgs e) { MainWindow.Close(); }
private static void App_SessionEnding(object sender, System.Windows.SessionEndingCancelEventArgs e) { Disconnect(); HideNotifyIcon(); }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { Settings.Default.Save(); }
protected virtual new void OnSessionEnding(SessionEndingCancelEventArgs e) { }
/// <summary> /// Called when the windows session is about to end. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e"> /// The <see cref="System.Windows.SessionEndingCancelEventArgs"/> instance containing the event data. /// </param> private void HandleSessionEnding(object sender, SessionEndingCancelEventArgs e) { // Check if there is unsaved data // Check if anything is running // throw new NotImplementedException(); }
// Invoked when Windows is being shutdown or user is being logged off. protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); // Cancel session ending unless it's safe to exit. e.Cancel = !IsSafeToExit; // If Exit event wasn't raised yet, perform explicit shutdown (Windows 7 bug workaround). if (!IsExiting) Shutdown(); }
void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e) { GMaps.Instance.CancelTileCaching(); }
void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e) { if (e.ReasonSessionEnding == ReasonSessionEnding.Shutdown) { if (MessageBoxResult.No == MessageBox.Show("Deseja mesmo fechar o SIAAN?","Fechar o SIAAN",MessageBoxButton.YesNo,MessageBoxImage.Question)) { e.Cancel = true; } else { e.Cancel = false; Application.Current.Shutdown(); } } }
private void Application_SessionEnding( object sender, SessionEndingCancelEventArgs ev ) { Debug.Print( "App.Application_SessionEnding: ReasonSessionEnding is {0}", ev.ReasonSessionEnding ); }
/// <summary> /// On finishing session /// </summary> /// <param name="e">SessionEndingCancel EventArgs</param> protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { Current.Shutdown(); base.OnSessionEnding(e); }
protected virtual void OnSessionEnding (SessionEndingCancelEventArgs args) { if (SessionEnding != null) SessionEnding (this, args); }
/// <summary> /// Raises the SessionEnding event. /// </summary> /// <param name="e">The arguments that describe this event.</param> protected virtual void OnSessionEnding(SessionEndingCancelEventArgs e) { if (SessionEnding != null) { SessionEnding(this, e); } }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { global::openPDCManager.Properties.Settings.Default.Save(); }
private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e) { }