Exemple #1
0
        static void UnhandledExceptionOccured(object sender, UnhandledExceptionEventArgs args)
        {
            //var path = Directory.GetCurrentDirectory() + "\\FileBackupLog\\log.txt";
            var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
                       + "\\FileBackup\\log.txt";
            var fileInfo = new FileInfo(path);

            fileInfo.Directory?.Create();

            // Show a message before closing application
            var dialogService = new MvvmDialogs.DialogService();

            dialogService.ShowMessageBox((INotifyPropertyChanged)(app.DataContext),
                                         "Oops, something went wrong and the application must close. Please find a " +
                                         "report on the issue at: " + path + Environment.NewLine +
                                         "If the problem persist, please contact [email protected]",
                                         "Unhandled Error",
                                         MessageBoxButton.OK);

            Exception e           = (Exception)args.ExceptionObject;
            var       errorWriter = new StreamWriter(path);

            errorWriter.WriteLine(e);
            errorWriter.Close();
        }
Exemple #2
0
 public NoteListViewModel()
 {
     Tabs = Utilities.SavedData.Open();
     Utilities.SavedData.Save(Tabs);
     NewNote        = new Commands.NewNoteCommand(this);
     TextSize       = TEXT_SIZE_DEFAULT;
     CurrentTab     = 0;
     SelectedIndex  = -1;
     TabsFocused    = true; // Unused
     _dialogService = new MvvmDialogs.DialogService(null, new Utilities.Locator(), null);
     ScrollUp       = new Commands.ScrollCommand(verticalScroll, -1);
     ScrollDown     = new Commands.ScrollCommand(verticalScroll, 1);
     ScrollLeft     = new Commands.ScrollCommand(horizontalScroll, -1);
     ScrollRight    = new Commands.ScrollCommand(horizontalScroll, 1);
     ResetFocus     = new Commands.SetPropertyCommand(setFocus, true);
     RemoveFocus    = new Commands.SetPropertyCommand(setFocus, false);
     DeleteNote     = new Commands.GenericCommand(deleteNote);
     NewTab         = new Commands.GenericCommand(createTab);
     DeleteTab      = new Commands.GenericCommand(deleteTab);
     OpenHelp       = new Commands.GenericCommand(openHelp);
     Reverse        = new Commands.GenericCommand(reverseNotes);
     Exit           = new Commands.CloseCommand(exitApplication);
     EditNote       = new Commands.GenericCommand(openEdit);
     ChangeTextSize = new Commands.BoolCommand(textSize);
 }
Exemple #3
0
        static void UnhandledExceptionOccured(object sender, UnhandledExceptionEventArgs args)
        {
            // Show a message before closing application
            var       dialogService = new MvvmDialogs.DialogService();
            Exception e             = (Exception)args.ExceptionObject;

            dialogService.ShowMessageBox((INotifyPropertyChanged)(app.DataContext),
                                         e.Message,
                                         "Unhandled Error",
                                         MessageBoxButton.OK);
        }
Exemple #4
0
        static void UnhandledExceptionOccured(object sender, UnhandledExceptionEventArgs args)
        {
            Exception e             = (Exception)args.ExceptionObject;
            var       dialogService = new MvvmDialogs.DialogService();

            dialogService.ShowMessageBox((INotifyPropertyChanged)(app.DataContext),
                                         string.Format("系统发生未知错误,错误信息:{0}。", e),
                                         Pub.AppName,
                                         MessageBoxButton.OK,
                                         MessageBoxImage.Error,
                                         MessageBoxResult.OK);


            Log.Fatal("Application has crashed", e);
        }
Exemple #5
0
        static void UnhandledExceptionOccured(object sender, UnhandledExceptionEventArgs args)
        {
            // Here change path to the log.txt file
            var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
                                                    + "\\idleo\\GetReport\\log.txt";

            // Show a message before closing application
            var dialogService = new MvvmDialogs.DialogService();
            dialogService.ShowMessageBox((INotifyPropertyChanged)(app.DataContext),
                "Oops, something went wrong and the application must close. Please find a " +
                "report on the issue at: " + path + Environment.NewLine +
                "If the problem persist, please contact idleo.",
                "Unhandled Error",
                MessageBoxButton.OK);

            Exception e = (Exception)args.ExceptionObject;
            Log.Fatal("Application has crashed", e);
        }
        static void UnhandledExceptionOccured(object sender, UnhandledExceptionEventArgs args)
        {
            // Here change path to the log.txt file
            var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
                       + "\\JCOX\\HC_LocalDB_MVVM_WPF\\log.txt";

            // Show a message before closing application
            var dialogService = new MvvmDialogs.DialogService();

            dialogService.ShowMessageBox((INotifyPropertyChanged)(app.DataContext),
                                         "A Unrecoverable Error has occured the application must close. Please review the " +
                                         "Log concerning the problem at: " + path + Environment.NewLine +
                                         "If the problem persist, please contact Support.",
                                         "Unhandled Error",
                                         MessageBoxButton.OK);

            Exception e = (Exception)args.ExceptionObject;

            Log.Fatal("Application has crashed", e);
        }