private void AddRecursive(CompositeNode model, int n, int levels) { for (int i = 0; i < n; i++) { var m2 = new CompositeNode { Name = model.Name + (char)('A' + i) }; model.Children.Add(m2); this.Count++; if (levels > 0) { this.AddRecursive(m2, n, levels - 1); } } }
private void AddRecursive(CompositeNode model, int n, int levels) { for (int i = 0; i < n; i++) { var m2 = new CompositeNode { Name = model.Name + (char)('A' + i) }; model.Children.Add(m2); this.Count++; if (levels > 0) { this.AddRecursive(m2, n, levels - 1); } } }
public NodeViewModel AddChild() { var cn = this.Node as CompositeNode; if (cn == null) { return(null); } var newChild = new CompositeNode() { Name = "New node" }; cn.Children.Add(newChild); var vm = new NodeViewModel(newChild, this); this.Children.Add(vm); return(vm); }
public NodeViewModel AddChild() { var cn = this.Node as CompositeNode; if (cn == null) { return null; } var newChild = new CompositeNode() { Name = "New node" }; cn.Children.Add(newChild); var vm = new NodeViewModel(newChild, this); this.Children.Add(vm); return vm; }