Пример #1
0
        /// <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)));
        }
Пример #2
0
        /// <summary>
        /// Expands this directory and find 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)));
        }