Example #1
0
 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);            
 }
Example #2
0
 private void SetSelectedDirectory(string fullPath)
 {
     SelectedDirectory = new DirectoryItem(fullPath, fullPath);
     txtSelectedDirectory.Text = SelectedDirectory.FullPath;            
 }
Example #3
0
        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();
        }                 
Example #4
0
 private void SetDefaultSelectedDirectory()
 {
     SelectedDirectory = new DirectoryItem(DefaultStartupDirectory, DefaultStartupDirectory);
     txtSelectedDirectory.Text = SelectedDirectory.FullPath;            
 }        
Example #5
0
 private TreeNode CreateNewNode(DirectoryItem subDirectory)
 {
     var node = new TreeNode(subDirectory.Name);
     node.Tag = subDirectory;
     return node;
 }