public void PerformDelete(string original) { string message = String.Format("Delete: Do you really want to delete the backup for this file ({0})?", original); if (MessageBox.ShowQuestion(message) != System.Windows.MessageBoxResult.Yes) { return; } BackupItemViewModel backup = null; foreach (BackupItemViewModel item in _Items) { if (item.Original == original) { backup = item; break; } } if (backup != null) { if (File.Exists(backup.Path)) { File.Delete(backup.Path); } } RemoveItem(original); }
private void PerformRestore(string original) { string message = String.Format("Restore: Are you sure you want to restore this file ({0})?", original); if (MessageBox.ShowQuestion(message) != System.Windows.MessageBoxResult.Yes) { return; } BackupItemViewModel backup = null; foreach (BackupItemViewModel item in _Items) { if (item.Original == original) { backup = item; break; } } if (backup != null) { RaiseRestoreRequested(original, backup.Contents); } }
public void AddItem(Models.BackupItem model) { BackupItemViewModel item = new BackupItemViewModel(model, this); Items.Add(item); }