private void Expand()
 {
     if (this.Type == DirectoryItemType.File)
     {
         return;
     }
     this.Children = new ObservableCollection <DirectoryItemViewModel>(DirectoryStructure.GetDirectoryContents(this.FullPath).Select(content => new DirectoryItemViewModel(content.FullPath, content.Type)));
 }
Exemple #2
0
        /// <summary>
        /// default constructor
        /// </summary>
        public DirectoryStructureViewModel()
        {
            // gets a List<DirectoryItem> of all the drives
            var children = DirectoryStructure.GetLogicalDrives();



            /* turns the List of DirectoryItem into a List of DirectoryItemViewModel
             * This is what FolderView is using as its source for the drives. After this is finished running completely,
             * the drives show up on the window.
             */
            this.Items = new ObservableCollection <DirectoryItemViewModel>
                             (children.Select(drive => new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive)));
        }
Exemple #3
0
        /// <summary>
        /// expands this directory and finds all children
        /// </summary>
        private void Expand()
        {
            // cannot expand file
            if (this.Type == DirectoryItemType.File)
            {
                return;
            }

            // returns a List<DirectoryItem> of all the children of the drive.
            var children = DirectoryStructure.GetDirectoryContents(this.FullPath);

            // This is creating an ObservableColletion (which sends notifications when it's changed) out of the List<DiscoveryItem> children (looping through the list),
            // which are first being called and run through DirectoryItemViewModel.
            this.Children = new ObservableCollection <DirectoryItemViewModel>(children.Select(content => new DirectoryItemViewModel(content.FullPath, content.Type)));
        }
 public DirectoryStructureViewModel()
 {
     this.Items = new ObservableCollection <DirectoryItemViewModel>(DirectoryStructure.GetlogicalDrives().Select(drive =>
                                                                                                                 new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive)));
 }