private async Task BasicTree(TreeNode treeNode) { Directory[] directories; TreeNode node; node = new TreeNode("Drive") { Tag = await BrickExplorer.GetDirectory(BrickExplorer.PROJECTS_PATH), ImageIndex = 2, SelectedImageIndex = 2 }; directories = await Manager.Brick.Drive.GetDirectories(); Append(node, directories); treeNode.Nodes.Add(node); if (Manager.Brick.SDCard != null) { node = new TreeNode("SD Card") { Tag = await BrickExplorer.GetDirectory(BrickExplorer.SDCARD_PATH), ImageIndex = 3, SelectedImageIndex = 3 }; directories = await Manager.Brick.SDCard.GetDirectories(); Append(node, directories); treeNode.Nodes.Add(node); } }
private async void ToolStripButtonClicked(object sender, EventArgs e) { ToolStripButton button = (ToolStripButton)sender; string path = button.Tag.ToString(); Directory directory = await BrickExplorer.GetDirectory(path); DirectoryAction?.Invoke(this, directory, ActionType.OPEN); }
public async Task Initialize() { Directory root = await BrickExplorer.GetDirectory(BrickExplorer.ROOT_PATH); CURRENT_DIRECTORY = root; SELECTED_DIRECTORY = root; await folderTree.Initialize(root); await previewPane.Initialize(root); navigationBar.Initialize(); DirectoryContent content = await DirectoryContent.Get(root); directoryContentPane.Set(content); statusBar.Set(content.Info); if (UserSettings.Mode == Mode.BASIC) { Directory drive = await BrickExplorer.GetDirectory(BrickExplorer.PROJECTS_PATH); Execute(this, drive, ActionType.OPEN); } }
public static async Task <DirectoryContent> Get(Directory directory) { DirectoryContent content = new DirectoryContent { Path = directory.Path, Info = new DirectoryInfo(), }; switch (UserSettings.Mode) { case Mode.BASIC: { switch (directory.Path) { case BrickExplorer.ROOT_PATH: { List <Directory> dirs = new List <Directory>(); dirs.Add(await BrickExplorer.GetDirectory(BrickExplorer.PROJECTS_PATH)); if (Manager.Brick.SDCard != null) { dirs.Add(await BrickExplorer.GetDirectory(BrickExplorer.SDCARD_PATH)); } content.Directories = dirs.ToArray(); content.Info.ItemCount = content.Directories.Length; break; } case BrickExplorer.PROJECTS_PATH: { content.Directories = await Manager.Brick.Drive.GetDirectories(); content.Info.ItemCount = content.Directories.Length; break; } case BrickExplorer.SDCARD_PATH: { content.Directories = await Manager.Brick.SDCard.GetDirectories(); content.Info.ItemCount = content.Directories.Length; break; } default: { //only get files content.Files = await BrickExplorer.GetFiles(directory.Path); foreach (File file in content.Files) { content.Info.TotalByteSize += file.Size; } content.Info.ItemCount = content.Files.Length; break; } } return(content); } default: { Framework.Core.DirectoryContent dc = await BrickExplorer.GetDirectoryContent(directory.Path); content.Directories = dc.Directories; content.Files = dc.Files; foreach (File file in content.Files) { content.Info.TotalByteSize += file.Size; } content.Info.ItemCount = content.Directories.Length + content.Files.Length; return(content); } } }