ShowDialog() public method

Opens the window and returns only when the window is closed.
public ShowDialog ( string title, string message = null, string details = null ) : void
title string The title for the error dialog..
message string The error message to show. (Optional.)
details string Details of the error, such as a call stack. (Optional.)
return void
示例#1
0
        /// <summary>
        /// Invoked when an exception is not caught.
        /// </summary>
        /// <param name="sender">The <see cref="AppDomain"/>.</param>
        /// <param name="e">The event data.</param>
        private static void AppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                // Get the error message
                string errorMessage = e.ExceptionObject.ToString();

                // Dump the error to a file
                string dumpPath;
                if (TryDumpError(errorMessage, out dumpPath))
                {
                    errorMessage += Environment.NewLine;
                    errorMessage += Environment.NewLine;
                    errorMessage += string.Format(
                        Resources.ResourceManager.GetEffectiveProvider(),
                        Resources.ErrorManagerErrorHasBeenWritten,
                        dumpPath);
                }

                // Clean up old error dumps
                if (!TryCleanErrorDumps())
                {
                    errorMessage += Environment.NewLine;
                    errorMessage += Environment.NewLine;
                    errorMessage += Resources.ErrorManagerFailedToClean;
                }

                // Show an error dialog
                ErrorDialog errorDialog = new ErrorDialog();
                errorDialog.ShowDialog(Resources.ErrorManagerUnexpectedError, errorMessage);
            }
            finally
            {
                Application.Current.Shutdown(1);
            }
        }
        /// <summary>
        /// Invoked when the <see cref="UpdateCommand"/> is executed.
        /// </summary>
        /// <param name="sender">The <see cref="TimerWindow"/>.</param>
        /// <param name="e">The event data.</param>
        private void UpdateCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            Uri updateUri = UpdateManager.Instance.UpdateUri;
            if (updateUri != null && (updateUri.Scheme == Uri.UriSchemeHttp || updateUri.Scheme == Uri.UriSchemeHttps))
            {
                try
                {
                    Process.Start(updateUri.ToString());
                }
                catch (Exception ex)
                {
                    string message = string.Format(
                        Properties.Resources.TimerWindowCouldNotLaunchWebBrowserErrorMessage,
                        updateUri);

                    ErrorDialog dialog = new ErrorDialog();
                    dialog.ShowDialog(
                        title: Properties.Resources.TimerWindowCouldNotLaunchWebBrowserErrorTitle,
                        message: message,
                        details: ex.ToString());
                }
            }
        }