public static void ShowException(System.Exception exception, IWin32Window owner, bool infoOnly) { GlobalEvents.AllowIdleProcessing = false; try { if (Application.SplashForm != null && Application.SplashForm.Visible) { Application.SplashForm.Hide(); } } catch { } DialogResult result = DialogResult.Cancel; try { ExceptionDialog t = new ExceptionDialog(exception, infoOnly); if (owner == null) { result = t.ShowDialog(); } else { result = t.ShowDialog(owner); } } catch { try { MessageBox.Show("Fatal Error", "Fatal Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); } finally { EnvironmentHelper.FailFast(ApplicationInfo.ProductName + " :Fatal Error"); } } // Exits the program when the user clicks Abort. if (result == DialogResult.Abort) { EnvironmentHelper.FailFast("\n" + ApplicationInfo.ProductName + " - " + TranslateString("Terminated by user on error") + " : \n" + ExceptionText(exception)); } else { GlobalEvents.AllowIdleProcessing = true; } }
void BShowExceptionIfnoClick(object sender, EventArgs e) { ExceptionDialog.ShowException(exception, this, true); }
public static void ShowException(System.Exception exception, IWin32Window owner, bool infoOnly) { GlobalEvents.AllowIdleProcessing = false; try { if(Application.SplashForm != null && Application.SplashForm.Visible) Application.SplashForm.Hide(); } catch { } DialogResult result = DialogResult.Cancel; try { ExceptionDialog t = new ExceptionDialog(exception, infoOnly); if(owner == null) result = t.ShowDialog(); else result = t.ShowDialog(owner); } catch { try { MessageBox.Show("Fatal Error", "Fatal Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); } finally { EnvironmentHelper.FailFast(ApplicationInfo.ProductName + " :Fatal Error"); } } // Exits the program when the user clicks Abort. if (result == DialogResult.Abort) EnvironmentHelper.FailFast("\n" + ApplicationInfo.ProductName + " - " + TranslateString("Terminated by user on error") + " : \n" + ExceptionText(exception)); else GlobalEvents.AllowIdleProcessing = true; }