protected override void OnClosing() { var backupSets = BackupSets.Select(bs => bs.BackupSet); _backupSetService.SaveBackupSets(backupSets); base.OnClosing(); }
/// <summary> /// Method to invoke when the RemoveBackupSet command is executed. /// </summary> private void OnRemoveBackupSetExecute() { if (_messageService.Show(string.Format("Are you sure you want to delete the BackupSet '{0}'?", SelectedBackupSet), "Are you sure?", MessageButton.YesNo, MessageImage.Question) == MessageResult.Yes) { BackupSets.Remove(SelectedBackupSet); SelectedBackupSet = null; } }
/// <summary> /// Method to invoke when the RemoveBackupSet command is executed. /// </summary> private void OnRemoveBackupSetCollectionExecute() { //if (_messageService.Show(string.Format("Are you sure you want to delete the BackupSet '{0}'?", SelectedBackupSet), // "Are you sure?", MessageButton.YesNo, MessageImage.Question) == MessageResult.Yes) if (_messageBoxService.ShowMessage(string.Format("Are you sure you want to delete the BackupSet '{0}'?", SelectedBackupSet.Name), "Delete Backup Set", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { BackupSets.Remove(SelectedBackupSet); SelectedBackupSet = null; } }
/// <summary> /// Method to invoke when the AddBackupSet command is executed. /// </summary> private void OnAddBackupSetExecute() { var BackupSet = new BackupSet(); // Note that we use the type factory here because it will automatically take care of any dependencies // that the BackupSetViewModel will add in the future var typeFactory = this.GetTypeFactory(); var BackupSetViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <BackupSetViewModel>(BackupSet); if (_uiVisualizerService.ShowDialog(BackupSetViewModel) ?? false) { BackupSets.Add(BackupSet); } }