Esempio n. 1
0
        private void treeFiles_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            IFileSystemNode fsNode = e.Node.Tag as IFileSystemNode;

            if (fsNode != null && !fsNode.Loaded)
            {
                AppendChildren(e.Node, fsNode.GetChildren());
                fsNode.Loaded = true;                 // TODO: Set this in GetChildren, then TEST
            }
        }
Esempio n. 2
0
 private void Visit(NodeVisitCallback callback, IFileSystemNode node, HashSet <long> visitedClusters, double currentProgress, double outerProgress)
 {
     if (node is Folder)                //No zip support yet
     {
         List <IFileSystemNode> children = new List <IFileSystemNode>(node.GetChildren());
         for (int i = 0; i < children.Count; i++)
         {
             double          progress = currentProgress + outerProgress * ((double)i / (double)children.Count);
             IFileSystemNode child    = children[i];
             if (!callback(child, (ulong)(progress * 1000), 1000))
             {
                 break;
             }
             if (!visitedClusters.Contains(child.Identifier))
             {
                 visitedClusters.Add(child.Identifier);
                 Visit(callback, child, visitedClusters, progress, outerProgress / (double)children.Count);
             }
         }
     }
 }