Beispiel #1
0
        private void RefreshDomain(Node node)
        {
            NodeTreeNode nodeTreeNode = domain.Nodes.Cast<NodeTreeNode>().FirstOrDefault();

            if (nodeTreeNode == null)
            {
                nodeTreeNode = new NodeTreeNode(node);
                domain.Nodes.Add(nodeTreeNode);
            }
            else
            {
                nodeTreeNode.Node = node;
            }

            RefreshDomain(nodeTreeNode);

            nodeTreeNode.Expand();
        }
Beispiel #2
0
 public SetValueEvent(NodeTreeNode node)
 {
     Node = node;
     Time = 30;
 }
Beispiel #3
0
 public SetValueEvent(NodeTreeNode node)
 {
     Node = node;
     Time = 30;
 }
Beispiel #4
0
        private void RefreshDomain(NodeTreeNode parent)
        {
            List<Match> matches = parent.Node.Children
                .Select(x => new Match { Node = x })
                .ToList();

            int i = 0;

            foreach (Match match in matches)
            {
                for (int j = i; j < parent.Nodes.Count; ++j)
                {
                    if (match.Node.ToString() == parent.Nodes[i].Text)
                    {
                        match.NodeTreeNode = (NodeTreeNode)parent.Nodes[i];
                        i = j + 1;
                    }
                }
            }

            List<NodeTreeNode> matched = matches.Where(x => x.NodeTreeNode != null).Select(x => x.NodeTreeNode).ToList();

            var notMatched = parent.Nodes.Cast<NodeTreeNode>().Where(x => !matched.Contains(x)).ToList();

            foreach (NodeTreeNode nodeTreeNode in notMatched)
            {
                parent.Nodes.Remove(nodeTreeNode);
            }

            for (int j = 0; j < matches.Count; ++j)
            {
                if (matches[j].NodeTreeNode == null)
                {
                    parent.Nodes.Insert(j, new NodeTreeNode(matches[j].Node));
                }
                else
                {
                    ((NodeTreeNode) parent.Nodes[j]).Node = matches[j].Node;
                }
            }

            foreach (NodeTreeNode child in parent.Nodes)
            {
                RefreshDomain(child);
            }
        }