private static void CurrentOnDispatcherUnhandledException(DispatcherUnhandledExceptionEventArgs args, ILog log, IDialogManager dialogManager) { log.Error(args.Exception); args.Handled = true; dialogManager.ShowErrorMessageBox(args.Exception.ToString()); }
private static void TaskSchedulerOnUnobservedTaskException(UnobservedTaskExceptionEventArgs args, ILog log, IDialogManager dialogManager) { log.Error(args.Exception); args.SetObserved(); dialogManager.ShowErrorMessageBox(args.Exception.ToString()); }
//private static void DispatcherOnUnhandledException(DispatcherUnhandledExceptionEventArgs args, ILog log, MaterialDesignDialogManager dialogManager) //{ // log.Error(args.Exception); // args.Handled = true; // // dialogManager.ShowErrorMessageBox(args.Exception.ToString()); //} private static void CurrentDomainOnUnhandledException(UnhandledExceptionEventArgs args, ILog log, IDialogManager dialogManager) { var exception = args.ExceptionObject as Exception; var terminatingMessage = args.IsTerminating ? " The application is terminating." : string.Empty; var exceptionMessage = exception?.Message ?? "An unmanaged exception occured."; var message = string.Concat(exceptionMessage, terminatingMessage); ((Log4netLogger)log).Error(message, exception); dialogManager.ShowErrorMessageBox(args.ExceptionObject.ToString()); }