/// <summary> /// Last chance exception handler. /// </summary> /// <param name="sender">Calling object</param> /// <param name="e">Event arguments</param> void Current_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { TheBoxSoftware.Diagnostics.Logging.Log(e.Exception); // [#87] close the main window so we dont get any activation errors (for ever repeating error dialogues) ((MainWindow)App.Current.MainWindow).AllowFileRefreshing = false; e.Handled = true; Diagnostics.ErrorReporting errorReport = new Diagnostics.ErrorReporting(); errorReport.SetException(e.Exception); errorReport.ShowDialog(); App.Current.Shutdown(); }
/// <summary> /// Handles the Click event of the button control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void button_Click(object sender, RoutedEventArgs e) { Button b = (Button)sender; switch (b.Name) { case "cancel": this.Close(); break; case "report": Diagnostics.ErrorReporting reporting = new Diagnostics.ErrorReporting(); reporting.SetExceptions(this.Exceptions); reporting.ShowDialog(); this.Close(); break; default: throw new NotImplementedException(b.Name); } }