private TreeNode AddClassTreeNode2(TreeNode rootNode, ObjectClassDescriptor objDescriptor) { TreeNodeCollection parentNodes; if (objDescriptor == null) { TreeNode parentNode = FindNode(rootNode.Nodes, "HLAobjectRoot"); if (parentNode == null) { //tv.ImageList = imageList1; parentNode = new TreeNode("HLAobjectRoot"); parentNode.Name = "HLAobjectRoot"; parentNode.ImageIndex = 0; parentNode.SelectedImageIndex = 0; //tv.Nodes.Add(parentNode); rootNode.Nodes.Add(parentNode); } return(parentNode); } else if (objDescriptor.ParentDescriptors.Count != 0) { TreeNode parentNode = AddClassTreeNode2(rootNode, objDescriptor.ParentDescriptors[0]); parentNodes = parentNode.Nodes; } else { //parentNodes = tv.Nodes; parentNodes = rootNode.Nodes; } TreeNode tmpNode = FindNode(parentNodes, objDescriptor.Name); if (tmpNode != null) { return(tmpNode); } else { TreeNode node = new TreeNode(objDescriptor.Name); node.ImageIndex = 0; node.SelectedImageIndex = 0; HLAObjectClassPropertiesInformation nodeInfo = new HLAObjectClassPropertiesInformation(objDescriptor.objectDescription, null); node.Tag = nodeInfo; foreach (AttributeDescriptor attributeDescriptor in objDescriptor.AttributeDescriptors) { TreeNode nodeAttr = new TreeNode(attributeDescriptor.Name); HLAAttributePropertiesInformation nodeAttrInfo = new HLAAttributePropertiesInformation(attributeDescriptor.attribute, null); nodeAttr.ImageIndex = 2; nodeAttr.SelectedImageIndex = 2; nodeAttr.Tag = nodeAttrInfo; node.Nodes.Add(nodeAttr); } parentNodes.Add(node); return(node); } }
private TreeNode AddClassTreeNode(TreeView tv, HLAObjectClassAttribute attr, Type classType) { TreeNode parentNode; if (classType == typeof(HLAobjectRoot) || attr == null) { parentNode = FindNode(tv.Nodes, "HLAobjectRoot"); if (parentNode == null) { tv.ImageList = imageList1; parentNode = new TreeNode("HLAobjectRoot"); parentNode.Name = "HLAobjectRoot"; parentNode.ImageIndex = 0; parentNode.SelectedImageIndex = 0; tv.Nodes.Add(parentNode); } return(parentNode); } else { HLAObjectClassAttribute objectClass = (HLAObjectClassAttribute)System.Attribute.GetCustomAttribute(classType.BaseType, typeof(HLAObjectClassAttribute)); parentNode = AddClassTreeNode(tv, objectClass, classType.BaseType); } TreeNode tmpNode = FindNode(parentNode.Nodes, attr.Name); if (tmpNode != null) { return(tmpNode); } else { TreeNode node = new TreeNode(attr.Name); node.ImageIndex = 0; node.SelectedImageIndex = 0; HLAObjectClassPropertiesInformation nodeInfo = new HLAObjectClassPropertiesInformation(attr.ObjectClassInfo, classType.FullName); node.Tag = nodeInfo; parentNode.Nodes.Add(node); return(node); } }
private TreeNode AddClassTreeNode(TreeView tv, HLAObjectClassAttribute attr, Type classType) { TreeNode parentNode; if (classType == typeof(HLAobjectRoot) || attr == null) { parentNode = FindNode(tv.Nodes, "HLAobjectRoot"); if (parentNode == null) { tv.ImageList = imageList1; parentNode = new TreeNode("HLAobjectRoot"); parentNode.Name = "HLAobjectRoot"; parentNode.ImageIndex = 0; parentNode.SelectedImageIndex = 0; tv.Nodes.Add(parentNode); } return parentNode; } else { HLAObjectClassAttribute objectClass = (HLAObjectClassAttribute)System.Attribute.GetCustomAttribute(classType.BaseType, typeof(HLAObjectClassAttribute)); parentNode = AddClassTreeNode(tv, objectClass, classType.BaseType); } TreeNode tmpNode = FindNode(parentNode.Nodes, attr.Name); if (tmpNode != null) return tmpNode; else { TreeNode node = new TreeNode(attr.Name); node.ImageIndex = 0; node.SelectedImageIndex = 0; HLAObjectClassPropertiesInformation nodeInfo = new HLAObjectClassPropertiesInformation(attr.ObjectClassInfo, classType.FullName); node.Tag = nodeInfo; parentNode.Nodes.Add(node); return node; } }
private TreeNode AddClassTreeNode2(TreeNode rootNode, ObjectClassDescriptor objDescriptor) { TreeNodeCollection parentNodes; if (objDescriptor == null) { TreeNode parentNode = FindNode(rootNode.Nodes, "HLAobjectRoot"); if (parentNode == null) { //tv.ImageList = imageList1; parentNode = new TreeNode("HLAobjectRoot"); parentNode.Name = "HLAobjectRoot"; parentNode.ImageIndex = 0; parentNode.SelectedImageIndex = 0; //tv.Nodes.Add(parentNode); rootNode.Nodes.Add(parentNode); } return parentNode; } else if (objDescriptor.ParentDescriptors.Count != 0) { TreeNode parentNode = AddClassTreeNode2(rootNode, objDescriptor.ParentDescriptors[0]); parentNodes = parentNode.Nodes; } else //parentNodes = tv.Nodes; parentNodes = rootNode.Nodes; TreeNode tmpNode = FindNode(parentNodes, objDescriptor.Name); if (tmpNode != null) return tmpNode; else { TreeNode node = new TreeNode(objDescriptor.Name); node.ImageIndex = 0; node.SelectedImageIndex = 0; HLAObjectClassPropertiesInformation nodeInfo = new HLAObjectClassPropertiesInformation(objDescriptor.objectDescription, null); node.Tag = nodeInfo; foreach (AttributeDescriptor attributeDescriptor in objDescriptor.AttributeDescriptors) { TreeNode nodeAttr = new TreeNode(attributeDescriptor.Name); HLAAttributePropertiesInformation nodeAttrInfo = new HLAAttributePropertiesInformation(attributeDescriptor.attribute, null); nodeAttr.ImageIndex = 2; nodeAttr.SelectedImageIndex = 2; nodeAttr.Tag = nodeAttrInfo; node.Nodes.Add(nodeAttr); } parentNodes.Add(node); return node; } }