async private void ShowSubdirectories(DirectoryItem selectedDirectory) { TreeNode rootNode = CreateNewNode(selectedDirectory); directoryTreeView.Nodes.Add(rootNode); rootNode.Expand(); var directories = selectedDirectory.GetDirectories(); long totalSize = 0; long size = 0; foreach (var subDirectory in directories) { TreeNode node = CreateNewNode(subDirectory); rootNode.Nodes.Add(node); size = await subDirectory.GetSize(); node.Text = node.Text + " " + FormatFileSize(size); totalSize = UpdateTotalSize(totalSize, size); } size = await selectedDirectory.GetSize(); rootNode.Text = rootNode.Text + " " + FormatFileSize(size); }
private void SetSelectedDirectory(string fullPath) { SelectedDirectory = new DirectoryItem(fullPath, fullPath); txtSelectedDirectory.Text = SelectedDirectory.FullPath; }
private void directoryTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag.GetType() != typeof(DirectoryItem)) { return; } SelectedDirectory = (DirectoryItem) e.Node.Tag; txtSelectedDirectory.Text = SelectedDirectory.FullPath; ClearDirectoryTreeView(); ShowProcessing(); ShowSubdirectories(SelectedDirectory); HideProcessing(); }
private void SetDefaultSelectedDirectory() { SelectedDirectory = new DirectoryItem(DefaultStartupDirectory, DefaultStartupDirectory); txtSelectedDirectory.Text = SelectedDirectory.FullPath; }
private TreeNode CreateNewNode(DirectoryItem subDirectory) { var node = new TreeNode(subDirectory.Name); node.Tag = subDirectory; return node; }