/// <summary> /// Cosntructs a new item in the tree. /// </summary> /// <param name="parent"></param> /// <param name="name">Is the name of the item (eg.: 'C:\' or 'temp').</param> /// <param name="lazyLoadChildren"></param> protected TreeViewItemViewModel(TreeViewItemViewModel parent , string name , bool lazyLoadChildren , bool createDummyChild = true) { _parent = parent; _Name = name; _LazyLoadChildren = lazyLoadChildren; _children = new ObservableCollection <IFolder>(); if (createDummyChild == true) { this.ResetChildren(_LazyLoadChildren); } }
internal async static Task <List <FolderViewModel> > LoadSubFolderAsync(string path, TreeViewItemViewModel parent) { var items = await PathModel.LoadFoldersAsync(path); var viewmodelItems = new List <FolderViewModel>(); foreach (var item in items) { viewmodelItems.Add(new FolderViewModel(item, parent)); } return(viewmodelItems); }
public FolderViewModel(PathModel folder, TreeViewItemViewModel folderParent) : base(folderParent, folder.Name, true) { _folder = folder; }