private void DeleteSpecificBackup(object parameter) { try { string confirmationMessage = "Backup " + FileName + ".\n"; confirmationMessage += "Are you sure you want to delete this backup?\n\n"; confirmationMessage += "This process cannot be undo."; MessageBoxResult messageBoxResult = MessageBox.Show(confirmationMessage, "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (messageBoxResult == MessageBoxResult.Yes) { BackupIO.DeleteSpecificBackup(FileName); // Displaying the result to the user string shortcutsBackupPath = Helper.GetShortcutsBackupPath(); string backupFilePath = Path.Combine(shortcutsBackupPath, FileName); if (!File.Exists(backupFilePath)) { // Refresh the datasource ShortcutsVM shortcutsVM = ((App)Application.Current).DataContext; shortcutsVM.BackupVMs = new ObservableCollection <BackupVM>(); shortcutsVM.BackupVMs = BackupIO.GetBackupVMs(); } } } catch (Exception ex) { Error.ShowDialog(ex); } }
private void SetBackups() { try { // Clear old BackupVMs DataContext.BackupVMs = new ObservableCollection <BackupVM>(); // Get backup file names DataContext.BackupVMs = BackupIO.GetBackupVMs(); } catch (Exception ex) { Error.ShowDialog(ex); } }