/// <summary> Thread-safe Error Handler </summary> /// <remarks> This method accepts error events from the SCOUT library /// and connects them to the test application's error handler. </remarks> public static void HandleError(object sender, Error.Args e) { //// DEBUG FOR TESTING!! //Application.Current.Dispatcher.BeginInvoke( // System.Windows.Threading.DispatcherPriority.Normal, // new Action(() => // { // MessageBox.Show(string.Format("{0}: {1}", e.Severity, e.Message ), "DEBUG: NEW MESSAGE"); // })); //// // // // if (SubscribedToScoutErrorHandler) { Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { var ea = AppErrorReporterEvent; // avoid race condition if (null != ea) // avoid null condition { ea(null, e); } })); } else if (e.Severity == Enums.MessageLevel.Exception) { Exception NewException = e.Exception; throw NewException; } }
/// <summary> Thread-safe Error Handler </summary> /// <remarks> This method accepts error events from the SCOUT library /// and connects them to the test application's error handler. </remarks> public static void HandleError(object sender, Error.Args e) { if (SubscribedToScoutErrorHandler) { Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { var ea = AppErrorReporterEvent; // avoid race condition if (null != ea) // avoid null condition { ea(null, e); } })); } else if (e.Severity == Enums.MessageLevel.Exception) { Exception NewException = e.Exception; throw NewException; } }