示例#1
0
 public abstract CommandTreeNode AppendChild(Command command, GinNameAttribute commandAttribute, PropertyInfo property, GinArgumentAttribute propertyAttribute);
示例#2
0
 public override CommandTreeNode AppendChild(Command command, GinNameAttribute commandAttribute, PropertyInfo property, GinArgumentAttribute propertyAttribute)
 {
     var acceptNot = property.GetCustomAttributes(typeof(GinArgumentCommandAcceptNotAttribute), false);
     List<Type> notAcceptedTypes = null;
     if (acceptNot != null)
     {
         notAcceptedTypes = new List<Type>();
         foreach (var item in acceptNot)
         {
             notAcceptedTypes.Add(((GinArgumentCommandAcceptNotAttribute)item).NotAcceptedType);
         }
     }
     var acceptOnly = property.GetCustomAttributes(typeof(GinArgumentCommandAcceptOnlyAttribute), false);
     List<Type> acceptedTypes = null;
     if (acceptOnly != null)
     {
         acceptedTypes = new List<Type>();
         foreach (var item in acceptOnly)
         {
             acceptedTypes.Add(((GinArgumentCommandAcceptOnlyAttribute)item).AcceptedType);
         }
     }
     TreeNode node = new TreeNode()
     {
         Text = propertyAttribute.Name,
         ToolTipText = propertyAttribute.Description,
         ImageIndex = 1,
         SelectedImageIndex = 1,
         Tag = new TreeNodeData()
         {
             Command = command,
             CommandAttribute = commandAttribute,
             Property = property,
             PropertyAttribute = propertyAttribute,
             AcceptedTypes = acceptedTypes.ToArray(),
             NotAcceptedTypes = notAcceptedTypes.ToArray()
         }
     };
     _node.Nodes.Add(node);
     TreeViewTreeNode treeNode = new TreeViewTreeNode(node);
     ((TreeNodeData)node.Tag).Node = treeNode;
     return treeNode;
 }