예제 #1
0
        // Handle the UI exceptions by showing a dialog box, and asking the user whether or not they wish to abort execution.
        private static void UIThreadException(object sender, ThreadExceptionEventArgs t)
        {
            DialogResult result = DialogResult.Cancel;

            try
            {
                // Todo: make this translatable
                ErrorWindow.ShowErrorDialog("An unhandled exception has occurred." + Environment.NewLine + "You can continue running the program (albeit with potential side-effects), but please report this error.", t.Exception, true);
            }
            catch
            {
                try
                {
                    // Todo: make this translatable
                    MessageBox.Show("A fatal error has occurred in pk3DS, and the details could not be displayed.  Please report this to the author.", "pk3DS Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }

            // Exits the program when the user clicks Abort.
            if (result == DialogResult.Abort)
            {
                Application.Exit();
            }
        }
예제 #2
0
 // Handle the UI exceptions by showing a dialog box, and asking the user whether
 // or not they wish to abort execution.
 // NOTE: This exception cannot be kept from terminating the application - it can only
 // log the event, and inform the user about it.
 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     try
     {
         var ex = (Exception)e.ExceptionObject;
         // Todo: make this translatable
         ErrorWindow.ShowErrorDialog("An unhandled exception has occurred." + Environment.NewLine + "The program must now close.", ex, false);
     }
     catch
     {
         try
         {
             // Todo: make this translatable
             MessageBox.Show("A fatal non-UI error has occurred in PKHeX, and the details could not be displayed.  Please report this to the author.", "PKHeX Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         finally
         {
             Application.Exit();
         }
     }
 }