Ejemplo n.º 1
0
 static void ShowErrorBox(Exception exception, string message, bool mustTerminate)
 {
     // ignore reentrant calls (e.g. when there's an exception in OnRender)
     if (showingBox)
         return;
     showingBox = true;
     try {
         if (exception != null) {
             try {
                 SD.AnalyticsMonitor.TrackException(exception);
             } catch (Exception ex) {
                 LoggingService.Warn("Error tracking exception", ex);
             }
         }
         using (ExceptionBox box = new ExceptionBox(exception, message, mustTerminate)) {
             if (SD.MainThread.InvokeRequired) {
                 box.ShowDialog();
             } else {
                 box.ShowDialog(SD.WinForms.MainWin32Window);
             }
         }
     } catch (Exception ex) {
         LoggingService.Warn("Error showing ExceptionBox", ex);
         MessageBox.Show(exception != null ? exception.ToString() : "Error", message, MessageBoxButtons.OK,
                         MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
     } finally {
         showingBox = false;
     }
 }