Beispiel #1
0
        public override CommandTreeNode InsertAfter(Command command, GinNameAttribute commandAttribute, CommandTreeNode nodeAfter)
        {
            TreeNode node = new TreeNode()
            {
                Text        = GetCommandName(command, commandAttribute),
                ToolTipText = commandAttribute.Description,
                ImageIndex  = 0,
                Tag         = new TreeNodeData()
                {
                    Command           = command,
                    CommandAttribute  = commandAttribute,
                    Property          = null,
                    PropertyAttribute = null,
                    AcceptedTypes     = null,
                    NotAcceptedTypes  = null
                }
            };
            TreeViewTreeNode afterNode = (TreeViewTreeNode)nodeAfter;
            int index = _node.Nodes.IndexOf(afterNode._node);

            if (index >= 0)
            {
                _node.Nodes.Insert(index + 1, node);
            }
            else
            {
                _node.Nodes.Add(node);
            }
            TreeViewTreeNode treeNode = new TreeViewTreeNode(node);

            ((TreeNodeData)node.Tag).Node = treeNode;
            return(treeNode);
        }
Beispiel #2
0
        public override void ClearChilds()
        {
            List <TreeNode> collectionCopy = new List <TreeNode>();

            foreach (TreeNode node in _node.Nodes)
            {
                collectionCopy.Add(node);
            }
            foreach (TreeNode node in collectionCopy)
            {
                TreeNodeData     data        = (TreeNodeData)node.Tag;
                TreeViewTreeNode currentNode = (TreeViewTreeNode)data.Node;
                currentNode._node.Remove();
            }
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public override CommandTreeNode AppendChild(Command command, GinNameAttribute commandAttribute)
        {
            TreeNode node = new TreeNode()
            {
                Text        = GetCommandName(command, commandAttribute),
                ToolTipText = commandAttribute.Description,
                ImageIndex  = 0,
                Tag         = new TreeNodeData()
                {
                    Command           = command,
                    CommandAttribute  = commandAttribute,
                    Property          = null,
                    PropertyAttribute = null,
                    AcceptedTypes     = null,
                    NotAcceptedTypes  = null
                }
            };

            _node.Nodes.Add(node);
            TreeViewTreeNode treeNode = new TreeViewTreeNode(node);

            ((TreeNodeData)node.Tag).Node = treeNode;
            return(treeNode);
        }
Beispiel #5
0
 public override CommandTreeNode InsertAfter(Command command, GinNameAttribute commandAttribute, CommandTreeNode nodeAfter)
 {
     TreeNode node = new TreeNode()
     {
         Text = GetCommandName(command, commandAttribute),
         ToolTipText = commandAttribute.Description,
         ImageIndex = 0,
         Tag = new TreeNodeData()
         {
             Command = command,
             CommandAttribute = commandAttribute,
             Property = null,
             PropertyAttribute = null,
             AcceptedTypes = null,
             NotAcceptedTypes = null
         }
     };
     TreeViewTreeNode afterNode = (TreeViewTreeNode)nodeAfter;
     int index = _node.Nodes.IndexOf(afterNode._node);
     if (index >= 0)
     {
         _node.Nodes.Insert(index + 1, node);
     }
     else
     {
         _node.Nodes.Add(node);
     }
     TreeViewTreeNode treeNode = new TreeViewTreeNode(node);
     ((TreeNodeData)node.Tag).Node = treeNode;
     return treeNode;
 }
Beispiel #6
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;
 }
Beispiel #7
0
 public override CommandTreeNode AppendChild(Command command, GinNameAttribute commandAttribute)
 {
     TreeNode node = new TreeNode()
     {
         Text = GetCommandName(command, commandAttribute),
         ToolTipText = commandAttribute.Description,
         ImageIndex = 0,
         Tag = new TreeNodeData()
         {
             Command = command,
             CommandAttribute = commandAttribute,
             Property = null,
             PropertyAttribute = null,
             AcceptedTypes = null,
             NotAcceptedTypes = null
         }
     };
     _node.Nodes.Add(node);
     TreeViewTreeNode treeNode = new TreeViewTreeNode(node);
     ((TreeNodeData)node.Tag).Node = treeNode;
     return treeNode;
 }