コード例 #1
0
        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);
            }
        }
コード例 #2
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);
        }