示例#1
0
        /// <summary>
        /// Fallback if we happen to take an exception in a non-gui routine (shouldn't happen!)
        /// </summary>
        private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            // TODO discriminate between the GUI and Non_GUI case.
            var feedbackSent = AppLog.SendFeedback("Unhandled Exception\r\n" + e.ExceptionObject.ToString(), true);

            MainWindow.Dispatcher.BeginInvoke((Action) delegate()
            {
                var dialog = new PerfView.Dialogs.UnhandledExceptionDialog(MainWindow, e.ExceptionObject, feedbackSent);
                var ret    = dialog.ShowDialog();
            });
        }
示例#2
0
        /// <summary>
        /// Called when exception happens in a GUI routine
        /// </summary>
        private void OnGuiUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            bool   userLevel;
            string message = ExceptionMessage.GetUserMessage(e.Exception, out userLevel);

            if (userLevel)
            {
                // TODO FIX NOW would really like to find the window with focus, and not always use the main window...
                MainWindow.Focus();
                MainWindow.StatusBar.LogError(message);
                e.Handled = true;
            }
            else
            {
                var feedbackSent = AppLog.SendFeedback("Unhandled Exception in GUI\r\n" + e.Exception.ToString(), true);
                var dialog       = new PerfView.Dialogs.UnhandledExceptionDialog(MainWindow, e.Exception, feedbackSent);
                var ret          = dialog.ShowDialog();
                // If it returns, it means that the user has opted to continue.
                e.Handled = true;
            }
        }