private void AddChildToTree(TreeNode <CanonicTreeItem> canonicTree, CanonicItem canonic) { if (canonic == null || canonic.Attributes == null || canonic.Attributes.Count == 0) { return; } var firstItem = canonic.Attributes.First(); TreeNode <CanonicTreeItem> foundNode = canonicTree.FindTreeNode(node => node.Data.NodeName == firstItem); if (foundNode == null) { var propertyType = ReflectionHelper.GetCurrentPropertyType(canonicTree.Data, firstItem); CanonicTreeItem treeItem = new CanonicTreeItem(firstItem, canonic.Name, propertyType); var currentNode = canonicTree.AddChild(treeItem); canonic.Attributes.RemoveAt(0); AddChildToTree(currentNode, canonic); } else { canonic.Attributes.RemoveAt(0); AddChildToTree(foundNode, canonic); } }
private void Initialize() { var rootTypeName = _canonicList.First().Root; var rootType = ReflectionHelper.GetRequestType(rootTypeName); CanonicTreeItem canonicTreeItem = new CanonicTreeItem(rootTypeName, rootTypeName, rootType); CanonicTree = new TreeNode <CanonicTreeItem>(canonicTreeItem); }