コード例 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            try {
                // set up a global exception handler for all unhandled exceptions
                Current.DispatcherUnhandledException       += GlobalExceptionHandler;
                AppDomain.CurrentDomain.UnhandledException += AppDomainExceptionHandler;

                base.OnStartup(e);
            } catch (Exception ex) {
                WpfLogger.LogError("Something failed starting up the applciaiton!", ex);
                MessageBox.Show("Something failed starting up the applciaiton!",
                                "Todos Application", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                Environment.Exit(9);
            }
        }
コード例 #2
0
 private static void HandleUnhandledException(Exception exception)
 {
     WpfLogger.LogError(exception.GetBaseException().Message, exception);
     MessageBox.Show(TechErrorMsg, "Error",
                     MessageBoxButton.OK, MessageBoxImage.Error);
 }