Exemplo n.º 1
0
 private void FolderFileHierarchyItemSelectedEvent(FileHierarchyItem folder)
 {
     _selectedFileItem = null;
     FillSystemItemsIn(folder.systemItem.path);
 }
Exemplo n.º 2
0
        private void FillSystemItemsIn(string path, bool ignoreSavePath = false)
        {
            Reset();


            _folderItems = new List <FileHierarchyItem>();
            _fileItems   = new List <FileHierarchyItem>();
            _cdItems     = new List <DriveHierarchyItem>();

            DirectoryInfo dir = new DirectoryInfo(path);



            FileHierarchyItem fileHierarchyItem;

            if (dir.Exists)
            {
                foreach (var item in dir.GetDirectories())
                {
                    fileHierarchyItem = new FileHierarchyItem(_parentOfContentItems, new SystemItem()
                    {
                        name = item.Name,
                        path = item.FullName,
                        type = Enumerators.SystemItemType.FOLDER
                    });

                    fileHierarchyItem.FileHierarchyItemSelectedEvent += FolderFileHierarchyItemSelectedEvent;

                    _folderItems.Add(fileHierarchyItem);
                }

                foreach (var item in dir.GetFiles())
                {
                    fileHierarchyItem = new FileHierarchyItem(_parentOfContentItems, new SystemItem()
                    {
                        name = item.Name,
                        path = item.FullName,
                        type = Enumerators.SystemItemType.FILE
                    });

                    fileHierarchyItem.FileHierarchyItemSelectedEvent += FileHierarchyItemSelectedEvent;;

                    _fileItems.Add(fileHierarchyItem);
                }
            }

            DriveHierarchyItem driveHierarchyItem;

            foreach (var item in Directory.GetLogicalDrives())
            {
                driveHierarchyItem = new DriveHierarchyItem(_parentOfCDItems, new SystemItem()
                {
                    name = item,
                    path = item,
                    type = Enumerators.SystemItemType.CD
                });

                driveHierarchyItem.DriveHierarchyItemSelectedEvent += DriveHierarchyItemSelectedEvent;;

                _cdItems.Add(driveHierarchyItem);
            }

            InternalTools.FixVerticalLayoutGroupFitting(_parentOfContentItems);
            InternalTools.FixVerticalLayoutGroupFitting(_parentOfCDItems);

            _contentScrollRect.verticalNormalizedPosition = 1f;

            _currentPathText.text = path;

            if (!ignoreSavePath)
            {
                _historyOfOpenedPathes.Add(path);
            }
        }
Exemplo n.º 3
0
 private void FileHierarchyItemSelectedEvent(FileHierarchyItem file)
 {
     _selectedFileItem = file.systemItem;
 }