Ejemplo n.º 1
0
        private static IEnumerable <LazyObservableTree <DirectoryInfo> > getChildrenFromSource(LazyObservableTree <DirectoryInfo> root)
        {
            Logger.WriteLine($"GenerateCildren: this= {root.Value.FullName}");
            var linkTree = root as LinkedLayTree;

            if (linkTree == null)
            {
                return(new LinkedLayTree[0]);
            }
            if (!linkTree.Source.AreChildrenGenerated)
            {
                //linkTree.RemoveSourceEvents(linkTree.Source);
                linkTree.Source.GenerateChildren();
                //linkTree.AddSourceEvents(linkTree.Source);
                return(new LinkedLayTree[0]);
            }
            var selectedChildren = linkTree.Source.Children.Cast <LazyDirectoryTree>()
                                   .Where(child => child.IsSelected != false)
                                   .ToArray();
            var newChildren = selectedChildren.Select(child =>
            {
                var newTree = new LinkedLayTree(child);
                return(newTree);
            });

            return(newChildren);
        }
Ejemplo n.º 2
0
        private void DirList_ItemAdded(ICollection <DirectoryInfo> sender, DirectoryInfo newItem, int index)
        {
            var newLazyDirectoryTree = new LazyDirectoryTree(newItem);
            var newLinkedTree        = new LinkedLayTree(newLazyDirectoryTree);

            this.LinkedRootList.Add(newLinkedTree);
            this.SourceRootList.Add(newLazyDirectoryTree);
        }
Ejemplo n.º 3
0
        private void Source_ChildTreeAttached(ObservableSortedTree <DirectoryInfo> sender, ObservableSortedTree <DirectoryInfo> child)
        {
            Logger.WriteLine($"{nameof(Source_ChildTreeAttached)}: Sender= {sender.Value.FullName}  Child= {child.Value.FullName}  this= {this.Value.FullName}");

            var lchild = child as LazyDirectoryTree;

            if (lchild != null)
            {
                lchild.IsSelectedChanged += SourceChild_IsSelectedChanged;
                if (lchild.IsSelected != false)
                {
                    if (this.AreChildrenGenerated)
                    {
                        var newChild = new LinkedLayTree(lchild);
                        this.Children.Add(newChild);
                    }
                    //FindOrAddDirectoryToDest(child.Value);
                }
                //child.ChildTreeAttached += Source_ChildTreeAttached;
                //child.ChildTreeDetached += Source_ChildTreeDetached;
            }
        }
Ejemplo n.º 4
0
 private static int CompareLinkedTrees(LinkedLayTree link1, LinkedLayTree link2)
 {
     return(string.Compare(link1.Source.Value.FullName,
                           link2.Source.Value.FullName,
                           StringComparison.InvariantCultureIgnoreCase));
 }