コード例 #1
0
 /// <summary>
 /// Handles the ThreadException event of the Application control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Threading.ThreadExceptionEventArgs"/> instance containing the event data.</param>
 private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
 {
     if (_mainWindow == null)
     {
         SimpleExceptionViewer.Show(null, e.Exception, "An Unhandled exception occurred.");
     }
     else
     {
         _mainWindow.Invoke(new Action <Exception>((a) => SimpleExceptionViewer.Show(null, a, "An Unhandled exception occurred.")), new object[] { e.Exception });
     }
 }
コード例 #2
0
 /// <summary>
 /// Handles the UnhandledException event of the CurrentDomain control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.UnhandledExceptionEventArgs"/> instance containing the event data.</param>
 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (_mainWindow == null)
     {
         SimpleExceptionViewer.Show(null, (Exception)e.ExceptionObject, "An unhandled exception occurred.");
     }
     else
     {
         _mainWindow.Invoke(new Action <Exception>((a) => SimpleExceptionViewer.Show(null, a, "An Unhandled exception occurred.")),
                            new object[] { (Exception)e.ExceptionObject });
     }
 }