public IngestDirectoryViewmodel(IngestDirectory model, ObservableCollection <IngestDirectoryViewmodel> ownerCollection) : base(model) { Array.Copy(AspectConversions, AspectConversionsEnforce, 3); OwnerCollection = ownerCollection; SubDirectoriesVM = new ObservableCollection <IngestDirectoryViewmodel>(model.SubDirectoriesSerialized.Select(s => { var newVm = new IngestDirectoryViewmodel(s, SubDirectoriesVM); newVm.Load(); return(newVm); })); }
private void _add(object obj) { var newDir = new IngestDirectoryViewmodel(new IngestDirectory(), _directories) { DirectoryName = Common.Properties.Resources._title_NewDirectory }; _directories.Add(newDir); _added = true; SelectedDirectory = newDir; }
public IngestDirectoryViewmodel AddSubdirectory() { var dir = new IngestDirectory() { DirectoryName = Common.Properties.Resources._title_NewDirectory }; var dirVM = new IngestDirectoryViewmodel(dir, SubDirectoriesVM); SubDirectoriesVM.Add(dirVM); IsModified = true; return(dirVM); }
private bool _deleteDirectory(ObservableCollection <IngestDirectoryViewmodel> collection, IngestDirectoryViewmodel item) { if (collection.Contains(item)) { collection.Remove(item); return(true); } foreach (var d in collection) { if (_deleteDirectory(d.SubDirectoriesVM, item)) { return(true); } } return(false); }