/// <summary> /// Default Constructor /// </summary> public DirectoryStructureViewModel() { // Get the logical Drives var children = DirectoryStructure.GetLogicalDrives(); // Create the view models from the data this.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 (this.Type == DirectoryItemType.File) { return; } // Find all children this.Children = new ObservableCollection <DirectoryItemViewModel>(DirectoryStructure.GetDirectoryContents(this.FullPath).Select(content => new DirectoryItemViewModel(content.FullPath, content.Type))); }