Exemplo n.º 1
0
 public DummyFatalExceptionHandler()
 {
     // We don't want to rely on the extension framework in the
     // case of a fatal exception, so the ExceptionDialog class will
     // create it's factory on app startup.
     ExceptionDialog.CheckCanShow();
 }
        private void ShowExceptionDialog(string message)
        {
            try
            {
                ExceptionDialog.Show(message, _exception, ExceptionDialogActions.Ok);
            }
            catch (Exception dialogException)
            {
                Platform.Log(LogLevel.Debug, dialogException);

                // fallback to displaying the message in a message box
                DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Reports an exception that was not handled in code to the user.
        /// </summary>
        /// <remarks>
        /// An exception dialog will be shown to the user, but will only show the stack trace based
        /// on the value of <see cref="ExceptionHandlerSettings.ShowStackTraceInDialog"/>.  The application
        /// will be shut down automatically by this method.
        /// </remarks>
        public static void ReportUnhandled(Exception e)
        {
            Platform.Log(LogLevel.Fatal, e);

            lock (_syncLock)
            {
                if (_fatalExceptionReported)
                {
                    return;
                }

                //Only ever show it once.
                _fatalExceptionReported = true;
            }

            ExceptionDialog.Show(SR.MessageUnexpectedErrorQuit, ShowStackTraceInDialog ? e : null, ExceptionDialogActions.Quit);
        }