/// <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))); }
private void ExpandDir() { string navPath = ((MainWindow)System.Windows.Application.Current.MainWindow).Navigator.Text; MessageBox.Show(navPath); // Find all children var children = DirectoryStructure.GetDirectoryContents(navPath); this.Children = new ObservableCollection <DirectoryItemViewModel>( children.Select(dir => new DirectoryItemViewModel(navPath, DirectoryItemType.Folder))); }
/// <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 var children = DirectoryStructure.GetDirectoryContents(this.FullPath); this.Children = new ObservableCollection <DirectoryItemViewModel>( children.Select(content => new DirectoryItemViewModel(content.FullPath, content.Type))); }