/// <summary> /// Default constructor /// </summary> public DirectoryStructureViewModel() { // get the logical drives var children = DirectoryStructure.GetLogicalDrives(); // Create the view models from the data Items = new ObservableCollection <DirectoryItemViewModel>(children.Select(drive => new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive))); }
/// <summary> /// Expands this directory and finds all children /// </summary> private void Expand() { // we cannot expand a file if (Type == DirectoryItemType.File) { return; } // Find all children var children = DirectoryStructure.GetDirectoryContents(FullPath); Children = new ObservableCollection <DirectoryItemViewModel>(children.Select(content => new DirectoryItemViewModel(content.FullPath, content.Type))); }