public void CreateSubFolder(PresetFolderViewModel folderViewModel) { var dialogVM = new ChooseNameViewModel(EncodingRes.ChooseNameSubfolder, new List <string>()); dialogVM.Name = EncodingRes.DefaultPresetFolderName; var windowManager = Ioc.Get <IWindowManager>(); windowManager.OpenDialog(dialogVM, windowManager.Find <EncodingWindowViewModel>()); if (dialogVM.DialogResult) { string subfolderName = dialogVM.Name; PresetFolder newFolder = PresetFolderStorage.AddFolder(subfolderName, folderViewModel.Id); folderViewModel.AddSubfolder(PresetFolderViewModel.FromPresetFolder(newFolder, this)); } }
public void SaveFolderIsExpanded(PresetFolderViewModel folderViewModel) { if (folderViewModel.Id > 0) { // If ID > 0 then this is a custom preset folder. PresetFolderStorage.SetFolderIsExpanded(folderViewModel.Id, folderViewModel.IsExpanded); } else { // If not stored in preset folder table, save in config. string key; if (folderViewModel == this.customPresetFolder) { key = CustomFolderKey; } else if (folderViewModel == this.builtInFolder) { key = BuiltInFolderKey; } else { key = folderViewModel.Name; } if (folderViewModel.IsExpanded) { if (this.collapsedBuiltInFolders.Contains(key)) { this.collapsedBuiltInFolders.Remove(key); } } else { if (!this.collapsedBuiltInFolders.Contains(key)) { this.collapsedBuiltInFolders.Add(key); } } CustomConfig.CollapsedBuiltInFolders = this.collapsedBuiltInFolders; } }
public void RenameFolder(PresetFolderViewModel folderViewModel) { var dialogVM = new ChooseNameViewModel(EncodingRes.ChooseNewFolderName, new List <string>()); dialogVM.Name = folderViewModel.Name; var windowManager = Ioc.Get <IWindowManager>(); windowManager.OpenDialog(dialogVM, windowManager.Find <EncodingWindowViewModel>()); if (dialogVM.DialogResult) { string newName = dialogVM.Name; if (newName != folderViewModel.Name) { PresetFolderStorage.RenameFolder(folderViewModel.Id, newName); folderViewModel.Name = newName; // Remove and re-add the folder to get the folder in the right order. PresetFolderViewModel parentFolder = folderViewModel.Parent; parentFolder.RemoveSubfolder(folderViewModel); parentFolder.AddSubfolder(folderViewModel); } } }
public void RemoveFolder(PresetFolderViewModel folderViewModel) { PresetFolderStorage.RemoveFolder(folderViewModel.Id); this.RemoveFolderFromTree(this.customPresetFolder, folderViewModel); }