A window that displays an error.
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        /// <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());
                }
            }
        }