Пример #1
0
        /// <summary>
        /// Implements the logic to terminate the desktop, including closing all windows and terminating the session.
        /// </summary>
        /// <returns>True if the application is really going to terminate, false otherwise.</returns>
        private void DoQuit(bool force)
        {
            if (IsQuitting)
            {
                return;
            }

            PhoneHome.ShutDown();

            if (!force)
            {
                _quitState = QuitState.QuittingNormally;
                if (!CloseAllWindows())
                {
                    _quitState = QuitState.NotQuitting;
                    return;
                }

                // send quitting event
                QuittingEventArgs args = new QuittingEventArgs();
                OnQuitting(args);
            }
            else
            {
                _quitState = QuitState.QuittingForcefully;
            }

            try
            {
                SessionManager.Current.TerminateSession();
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Error, e);
            }

            // shut down the GUI message loop
            TerminateGuiToolkit();
        }
Пример #2
0
 /// <summary>
 /// Raises the <see cref="Quitting"/> event.
 /// </summary>
 protected virtual void OnQuitting(QuittingEventArgs args)
 {
     EventsHelper.Fire(_quitting, this, args);
 }