void ReadSelect() { Func <Data.NodeBase, Utils.DelayedList <NodeTreeViewNode>, NodeTreeViewNode> search_node = null; search_node = (searched_node, treenodes) => { if (search_node == null) { return(null); } for (int i = 0; i < treenodes.Count; i++) { if (treenodes[i].Node == searched_node) { return(treenodes[i]); } var ret = search_node(searched_node, treenodes[i].Children); if (ret != null) { return(ret); } } return(null); }; var node = search_node(Core.SelectedNode, Children); SelectedNode = node; }
public NodeTreeViewNode(NodeTreeView treeView, Data.NodeBase node, bool createChildren = false) { UniqueID = Manager.GetUniqueID(); id = "###" + UniqueID.ToString(); this.treeView = treeView; this.Node = node; if (createChildren) { for (int i = 0; i < node.Children.Count; i++) { var newNode = new NodeTreeViewNode(treeView, node.Children[i], true); Children.Add(newNode); } } AddEvent(false); }
public NodeTreeViewNode(NodeTreeView treeView, Data.NodeBase node, bool createChildren = false) { UniqueID = Manager.GetUniqueID(); id = "###" + UniqueID.ToString(); this.treeView = treeView; this.Node = node; node.OnAfterAddNode += OnAfterAddNode; node.OnAfterRemoveNode += OnAfterRemoveNode; node.OnAfterExchangeNodes += OnAfterExchangeNodes; if (createChildren) { for (int i = 0; i < node.Children.Count; i++) { var newNode = new NodeTreeViewNode(treeView, node.Children[i], true); Children.Add(newNode); } } }
public NodeTreeViewNode(Data.NodeBase node, bool createChildren = false) { var rand = new Random(); id = "###" + rand.Next(0xffff).ToString(); this.node = node; node.OnAfterAddNode += OnAfterAddNode; node.OnAfterRemoveNode += OnAfterRemoveNode; node.OnAfterExchangeNodes += OnAfterExchangeNodes; if (createChildren) { for (int i = 0; i < node.Children.Count; i++) { var newNode = new NodeTreeViewNode(node.Children[i], true); Children.Add(newNode); } } }
void OnAfterAddNode(object sender, ChangedValueEventArgs e) { var node = e.Value as Data.NodeBase; Console.WriteLine(string.Format("OnAfterAddNode({0})", node.Name.Value)); int ind = 0; for (; ind < Node.Children.Count; ind++) { if (node == Node.Children[ind]) { break; } } NodeTreeViewNode treeViewNode = null; if (treeView.temporalChangingNodeTreeViews.ContainsKey(node)) { treeViewNode = treeView.temporalChangingNodeTreeViews[node]; treeViewNode.AddEvent(true); } else { treeViewNode = new NodeTreeViewNode(treeView, node, true); } if (ind == Children.Count) { Children.Add(treeViewNode); } else { Children.Insert(ind, treeViewNode); } }