Esempio n. 1
0
        private void InitializeTV()
        {
            TV_Show.BeginUpdate();



            foreach (MyFolder driver in browser.Folders)
            {
                TreeNode node = new TreeNode(driver.Name);
                node.Tag = driver;
                TV_Show.Nodes.Add(node);

                foreach (MyFolder folder in driver.Folders)
                {
                    TreeNode f_node = new TreeNode(folder.Name);
                    f_node.Tag = folder;
                    node.Nodes.Add(f_node);
                }
            }



            //DriveInfo[] allDrives = DriveInfo.GetDrives();
            //int i = 0;
            //foreach (DriveInfo d in allDrives)
            //{
            //    TV_Show.Nodes.Add(d.Name);
            //    DirectoryInfo di = new DirectoryInfo(d.Name);
            //    try
            //    {
            //        if (d.IsReady)
            //        {
            //            foreach (var dirf in di.GetFileSystemInfos())
            //            {

            //                TV_Show.Nodes[i].Nodes.Add(dirf.Name);

            //            }
            //        }
            //        i++;
            //    }
            //    catch (Exception)
            //    {
            //        throw new Exception();
            //    }
            //}
            TV_Show.EndUpdate();
        }
Esempio n. 2
0
        private void TV_Show_AfterExpand(object sender, TreeViewEventArgs e)
        {
            TV_Show.BeginUpdate();

            //MyFolder folder = e.Node.Tag as MyFolder;
            //folder.innerFolders();

            //foreach (MyFolder f in folder.Folders)
            //{
            //    if(f.Folders == null)
            //    {
            //        f.innerFolders();

            //    }
            //}
            MyFolder me = e.Node.Tag as MyFolder;

            me.innerFolders();
            foreach (TreeNode f in e.Node.Nodes)//sons
            {
                foreach (var sub in (f.Tag as MyFolder).Folders)
                {
                    TreeNode t = new TreeNode(sub.Name);
                    t.Tag = sub;
                    f.Nodes.Add(t);
                }
            }


            //foreach (TreeNode s in e.Node.Nodes)
            //{
            //    try
            //    {
            //        DirectoryInfo di = new DirectoryInfo(s.FullPath);
            //        foreach (var st in di.GetFileSystemInfos())
            //        {
            //            s.Nodes.Add(st.Name);
            //        }
            //    }
            //    catch (Exception)
            //    {
            //    }

            //}
            TV_Show.EndUpdate();
        }