コード例 #1
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public DirectoryStructureViewModel()
        {
            //Get all logical drives on the machine
            var childrenDrives = DirectoryStucture.GetLogicalDrives();

            //Create a view models from the data
            this.Items = new ObservableCollection <DirectoryItemViewModel>(
                childrenDrives.Select(drive => new DirectoryItemViewModel(drive.FullPath, DirectoryItemType.Drive, false)));
        }
コード例 #2
0
        /// <summary>
        /// Expand the directory and finds all children
        /// </summary>
        private void Expand()
        {
            //We cannot expand the file
            if (Type == DirectoryItemType.File)
            {
                return;
            }

            //Find all children
            var structure = DirectoryStucture.GetDirectoryContent(FullPath);

            Children = new ObservableCollection <DirectoryItemViewModel>(
                structure.Select(content => new DirectoryItemViewModel(content.FullPath, content.Type, content.IsHidden)));
        }