示例#1
0
        /// <summary>
        /// Creates a new ButtonAssignment.
        /// </summary>
        /// <param name="validator">The validator to use for validation.</param>
        /// <param name="node">The "button" node.</param>
        internal ButtonAssignment(NodeValidator validator, Node node)
            : base(validator, node)
        {
            if (node.Attributes.ContainsKey(NAME_ATTRIBUTE))
            {
                name = node.Attributes[NAME_ATTRIBUTE];
            }
            if (node.Attributes.ContainsKey(ROLE_ATTRIBUTE))
            {
                role = ButtonAssignmentRoleHelper.TryParse(node.Attributes[ROLE_ATTRIBUTE]);
            }

            if (role == ButtonAssignmentRole.Unprogrammed)
            {
                bands = new BandList();
            }
            else
            {
                foreach (var child in node.Children)
                {
                    if (child.Name.ToUpperInvariant() == BANDS_CHILD_NODE)
                    {
                        bands = new BandList(validator, child);
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// Creates a new button assignment for the given control.
 /// </summary>
 /// <param name="control">The control this assignment will assign to.</param>
 public ButtonAssignment(Control control)
     : base(control)
 {
     role  = ButtonAssignmentRole.Bands;
     bands = new BandList();
 }