Ejemplo n.º 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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 internal override void FillNode(Node node)
 {
     if (name != null)
     {
         node.Attributes.Add(NAME_ATTRIBUTE, name);
     }
     node.Attributes.Add(ROLE_ATTRIBUTE, ButtonAssignmentRoleHelper.ToString(role));
     if (bands != null)
     {
         node.Children.AddLast(bands.CreateNodes());
     }
 }