Exemplo n.º 1
0
 /// <summary>
 /// Shows the exception dialog, which allows the user to choose whether or not to continue</summary>
 /// <param name="exception">Exception</param>
 /// <returns>Nullable Boolean indicating how a window was closed by the user</returns>
 protected virtual bool? ShowExceptionDialog(Exception exception)
 {
     var dlg = new UnhandledExceptionDialog();
     dlg.DataContext = new UnhandledExceptionViewModel(exception.Message);
     if(Application.Current.MainWindow.IsVisible)
         dlg.Owner = Application.Current.MainWindow;
     return dlg.ShowDialog();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Shows the exception dialog that allows the user to choose whether or not to continue.
        /// If the user chooses not to continue, Environment.Exit(1) is called.</summary>
        /// <param name="exception">Exception raised</param>
        protected override void ShowExceptionDialog(Exception exception)
        {
            bool? result = null;
            try
            {
                var dlg = new UnhandledExceptionDialog();
                // Call ToString() to get the call stack. The Message property may not include that.
                dlg.DataContext = new UnhandledExceptionViewModel(exception.ToString());
                dlg.Owner = Application.Current.MainWindow;
                result = dlg.ShowDialog();

                if (UserFeedbackService != null)
                    UserFeedbackService.ShowFeedbackForm();
            }
            finally
            {
                if (result.HasValue && !result.Value)
                    Environment.Exit(1);
            }
        }