private void MakeChildren(TreeNode5 parent, int depth, ObservableCollection <TreeNode5> children) { if (depth >= MAX_DEPTH) { return; } for (int i = 0; i < MAX5; i++) { index++; TreeNode5 Evt = new TreeNode5(); if (i == 1 || i == 2) { // make a new branch // this branch is still associated with the parent branch // but its children are associated with the new branch Evt.Configure(parent, depth, index, true, false); Evt.Name = Evt.MakeName(); MakeChildren(Evt, depth + 1, Evt.Children); } else { Evt.Configure(parent, depth, index, false, false); Evt.Name = Evt.MakeName(); } children.Add(Evt); } }
// public List<EventTest3> Ev2List { get; private set; } = null; public EventTestMgr() { Root = new EventTest3(0, 0, 0, 0, 0, true); Root.Name = "Root (" + Root.Name + ")"; MakeChildren(Root, 1, 0, Root.childList); First = new EventTest4(0, 0, 0, 0, 0, true); First.Name = "First (" + First.Name + ")"; MakeChildren(First, 1, 0, First.childList); Origin = new TreeNode5(); Origin.Configure(null, 0, 0, true, true); Origin.Name = "Origin"; TreeNode5 Top = new TreeNode5(); Top.Configure(Origin, 1, 1, true, true); Top.Name = "First Element"; Origin.AddChild(Top); MakeChildren(Top, 1, Top.Children); Trunk = new Branch(); Tests(); }