public DirectoryStructureViewModel() { var children = DirectoryStructure.GetLogicalDrives(); // Creates view models from the given data this.Items = new ObservableCollection <DirectoryItemViewModel>( children.Select(drive => new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive))); }
/// <summary> /// Expands the directory and finds all children /// </summary> private void Expand() { if (this.Type == DirectoryItemType.File) { return; } // Finds all children this.Children = new ObservableCollection <DirectoryItemViewModel>(DirectoryStructure.GetDirectoryContents(this.FullPath).Select(content => new DirectoryItemViewModel(content.FullPath, content.Type))); }