Exemple #1
0
        //Form1_Load
        private void Form1_Load(object sender, EventArgs e)
        {
            List <TreeNode> lstDriveNodes = CFileSystem.RetrieveDriveList(trvFolders);

            foreach (TreeNode tnDrive in lstDriveNodes)
            {
                CFileSystem.RetrieveFolderList(tnDrive.FullPath, trvFolders, tnDrive);
            }
        }
Exemple #2
0
        //trvFolders_BeforeExpand
        private void trvFolders_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            List <TreeNode> lstPaths;
            List <TreeNode> lstSubPaths;

            //Clear the child nodes out (to refresh / update information)
            e.Node.Nodes.Clear();

            lstPaths = CFileSystem.RetrieveFolderList(e.Node.FullPath, trvFolders, e.Node);

            foreach (TreeNode tnPath in lstPaths)
            {
                lstSubPaths = CFileSystem.RetrieveFolderList(tnPath.FullPath, trvFolders, tnPath);

                //Go down a second level for knowing which folders can expand
                if (lstSubPaths != null)
                {
                    foreach (TreeNode tnSubPath in lstSubPaths)
                    {
                        CFileSystem.RetrieveFolderList(tnSubPath.FullPath, trvFolders, tnSubPath);
                    }
                }
            }
        }//end of trvFolders_BeforeExpand