Пример #1
0
        static void ShowErrorBox(Exception exception, string message, bool mustTerminate)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }

            // ignore reentrant calls (e.g. when there's an exception in OnRender)
            if (showingBox)
            {
                return;
            }
            showingBox = true;
            try {
                try {
                    AnalyticsMonitorService.TrackException(exception);
                } catch (Exception ex) {
                    LoggingService.Warn("Error tracking exception", ex);
                }
                using (ExceptionBox box = new ExceptionBox(exception, message, mustTerminate)) {
                    if (FrameWork.Gui.WorkbenchSingleton.InvokeRequired)
                    {
                        box.ShowDialog();
                    }
                    else
                    {
                        box.ShowDialog(FrameWork.Gui.WorkbenchSingleton.MainWin32Window);
                    }
                }
            } catch (Exception ex) {
                LoggingService.Warn("Error showing ExceptionBox", ex);
                MessageBox.Show(exception.ToString(), message, MessageBoxButtons.OK,
                                MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
            } finally {
                showingBox = false;
            }
        }