Exemplo n.º 1
0
 internal void OnTreeNodeDelete(FileTreeNode node)
 {
     ElementDeleted?.Invoke(node, new SFMEventArgs()
     {
         element = node.Value
     });
 }
Exemplo n.º 2
0
 public void SetRenamingNode(FileTreeNode nwRenamingNode)
 {
     if (CurrentRenamingNode != null)
     {
         CurrentRenamingNode.NotRenaming = true;
     }
     if (nwRenamingNode != null)
     {
         CurrentRenamingNode             = nwRenamingNode;
         CurrentRenamingNode.NotRenaming = false;
     }
 }
Exemplo n.º 3
0
        private void AddChildToNode(IFileSystemElement element)
        {
            FileTreeNode nwNode = new FileTreeNode(Tree, this, element);

            if (nwNode.IsDirectory)
            {
                ChildDirectoryNodes?.Add(nwNode);
            }
            else
            {
                ChildFileNodes?.Add(nwNode);
            }
        }
Exemplo n.º 4
0
        private bool RemoveChildFromNode(IFileSystemElement element)
        {
            ObservableCollection <FileTreeNode> targetCollection;
            FileTreeNode targetNode = FindNodeInCollection(out targetCollection, element);

            if (targetNode == null)
            {
                return(false);
            }

            targetCollection.Remove(targetNode);
            targetNode.SetUpdating(false);

            Tree.OnTreeNodeDelete(targetNode);
            return(true);
        }
Exemplo n.º 5
0
        internal FileTreeNode(DynamicFileSystemTree tree, FileTreeNode parent, IFileSystemElement value) : this(tree) {
            this.Value  = value;
            this.IsRoot = (parent == null);
            this.Parent = parent;

            this.OpenedAtLeastOnce = IsRoot;

            this.ChildrenInitialized = !IsDirectory;
            this.IsUpdating          = IsExpanded;

            this.PropertyChanged += SetIsUpdatingToIsExpanding;

            if (IsRoot || (parent != null && parent.OpenedAtLeastOnce && parent.ChildDirectoryNodes.Count < 256))
            {
                LoadChildren();
            }
            else
            {
                parent.PropertyChanged += OnPropertyChanged;
            }
        }
Exemplo n.º 6
0
        public bool Contains(FileTreeNode node)
        {
            if (!object.ReferenceEquals(node.Tree, this))
            {
                return(false);
            }

            var curNode = node;

            while (curNode.Parent != null)
            {
                var parentNode = curNode.Parent;
                if (!parentNode.ChildDirectoryNodes.Contains(curNode) && !parentNode.ChildFileNodes.Contains(curNode))
                {
                    return(false);
                }
                curNode = parentNode;
            }

            return(object.ReferenceEquals(curNode, Root));
        }
Exemplo n.º 7
0
        internal FileTreeNode(DynamicFileSystemTree tree, FileTreeNode child) : this(tree) {
            ChildDirectoryNodes = new ObservableCollection <FileTreeNode>();
            ChildFileNodes      = new ObservableCollection <FileTreeNode>();

            ChildDirectoryNodes.Add(child);
        }
Exemplo n.º 8
0
 internal void OnTreeNodeDelete(FileTreeNode node)
 {
     FileSystemFacade.Instance.OnTreeNodeDelete(node);
 }
Exemplo n.º 9
0
 public static void LoadNodesChildren(FileTreeNode targetNode)
 {
     targetNode.LoadChildren();
 }
Exemplo n.º 10
0
 internal DynamicFileSystemTree(SFMDirectory root)
 {
     Root = new FileTreeNode(this, null, root);
 }
Exemplo n.º 11
0
 public void SetRenamingNode(FileTreeNode node)
 {
     CurrentRenamingNode?.Tree.SetRenamingNode(null);
     node?.Tree.SetRenamingNode(node);
     CurrentRenamingNode = node;
 }