Esempio n. 1
0
        public void NodesAdded(IEnumerable <TreeNode> Nodes, TreeNode Parent)
        {
            Controls.ConnectionView View = this.XmppAccountNode?.View;

            foreach (TreeNode Node in Nodes)
            {
                View?.NodeAdded(Parent, Node);

                if (Node is DataSource DataSource)
                {
                    lock (this.dataSources)
                    {
                        this.dataSources[DataSource.Key] = DataSource;
                    }
                }
            }
        }
Esempio n. 2
0
        public void NodesRemoved(IEnumerable <TreeNode> Nodes, TreeNode Parent)
        {
            XmppAccountNode XmppAccountNode = this.Account;

            if (XmppAccountNode is null)
            {
                return;
            }

            Controls.ConnectionView View = XmppAccountNode.View;
            if (View is null)
            {
                return;
            }

            LinkedList <KeyValuePair <TreeNode, TreeNode> > ToRemove = new LinkedList <KeyValuePair <TreeNode, TreeNode> >();

            foreach (TreeNode Node in Nodes)
            {
                ToRemove.AddLast(new KeyValuePair <TreeNode, TreeNode>(Parent, Node));
            }

            while (ToRemove.First != null)
            {
                KeyValuePair <TreeNode, TreeNode> P = ToRemove.First.Value;
                ToRemove.RemoveFirst();

                Parent = P.Key;
                TreeNode Node = P.Value;

                if (Node.HasChildren.HasValue && Node.HasChildren.Value)
                {
                    foreach (TreeNode Child in Node.Children)
                    {
                        ToRemove.AddLast(new KeyValuePair <TreeNode, TreeNode>(Node, Child));
                    }
                }

                MainWindow.currentInstance.Dispatcher.BeginInvoke(new ThreadStart(() =>
                {
                    View.NodeRemoved(Parent, Node);
                }));
            }
        }
Esempio n. 3
0
        public void NodesRemoved(IEnumerable <TreeNode> Nodes, TreeNode Parent)
        {
            Controls.ConnectionView View = this.XmppAccountNode?.View;
            LinkedList <KeyValuePair <TreeNode, TreeNode> > ToRemove = new LinkedList <KeyValuePair <TreeNode, TreeNode> >();

            foreach (TreeNode Node in Nodes)
            {
                ToRemove.AddLast(new KeyValuePair <TreeNode, TreeNode>(Parent, Node));
            }

            while (ToRemove.First != null)
            {
                KeyValuePair <TreeNode, TreeNode> P = ToRemove.First.Value;
                ToRemove.RemoveFirst();

                Parent = P.Key;
                TreeNode Node = P.Value;

                if (Node.HasChildren.HasValue && Node.HasChildren.Value)
                {
                    foreach (TreeNode Child in Node.Children)
                    {
                        ToRemove.AddLast(new KeyValuePair <TreeNode, TreeNode>(Node, Child));
                    }
                }

                View?.NodeRemoved(Parent, Node);

                if (Node is DataSource DataSource)
                {
                    if (XmppAccountNode.IsOnline)
                    {
                        DataSource.UnsubscribeFromEvents();
                    }

                    lock (this.dataSources)
                    {
                        this.dataSources.Remove(DataSource.Key);
                    }
                }
            }
        }
Esempio n. 4
0
        public void NodesAdded(IEnumerable <TreeNode> Nodes, TreeNode Parent)
        {
            XmppAccountNode XmppAccountNode = this.XmppAccountNode;

            if (XmppAccountNode == null)
            {
                return;
            }

            Controls.ConnectionView View = XmppAccountNode.View;
            if (View == null)
            {
                return;
            }

            foreach (TreeNode Node in Nodes)
            {
                View.NodeAdded(Parent, Node);
            }
        }
Esempio n. 5
0
        public void NodesRemoved(IEnumerable <TreeNode> Nodes, TreeNode Parent)
        {
            XmppAccountNode XmppAccountNode = this.Account;

            if (XmppAccountNode == null)
            {
                return;
            }

            Controls.ConnectionView View = XmppAccountNode.View;
            if (View == null)
            {
                return;
            }

            LinkedList <KeyValuePair <TreeNode, TreeNode> > ToRemove = new LinkedList <KeyValuePair <TreeNode, TreeNode> >();

            foreach (TreeNode Node in Nodes)
            {
                ToRemove.AddLast(new KeyValuePair <TreeNode, TreeNode>(Parent, Node));
            }

            while (ToRemove.First != null)
            {
                KeyValuePair <TreeNode, TreeNode> P = ToRemove.First.Value;
                ToRemove.RemoveFirst();

                Parent = P.Key;
                TreeNode Node = P.Value;

                if (Node.HasChildren.HasValue && Node.HasChildren.Value)
                {
                    foreach (TreeNode Child in Node.Children)
                    {
                        ToRemove.AddLast(new KeyValuePair <TreeNode, TreeNode>(Node, Child));
                    }
                }

                View.NodeRemoved(Parent, Node);
            }
        }