Inheritance: CommandBarControl
Ejemplo n.º 1
0
 private static void AddControl(CommandBarControls parentControls, XmlNode xmlNode, GetImageDelegate getImage)
 {
     if (xmlNode.Name == "popup")
     {
         string          controlName = xmlNode.Attributes["caption"].Value;
         object          before      = ReadControlBeforeAttribute(xmlNode);
         CommandBarPopup newPopup    = parentControls.AddPopup(controlName, before);
         ApplyControlAttributes(newPopup, xmlNode, getImage);
         AddControls(newPopup.Controls, xmlNode.ChildNodes, getImage);
     }
     else if (xmlNode.Name == "button")
     {
         object           before    = ReadControlBeforeAttribute(xmlNode);
         CommandBarButton newButton = parentControls.AddButton(before);
         ApplyControlAttributes(newButton, xmlNode, getImage);
     }
 }
Ejemplo n.º 2
0
 private static void RemoveControl(CommandBarControls parentControls, XmlNode xmlNode)
 {
     if (xmlNode.Name == "popup")
     {
         string          controlName = xmlNode.Attributes["caption"].Value;
         CommandBarPopup cb          = (parentControls[controlName] as CommandBarPopup);
         if (cb != null)
         {
             RemoveControls(cb.Controls, xmlNode.ChildNodes);
             if (cb.Controls.Count() == 0)
             {
                 cb.Delete(true);
             }
         }
     }
     if (xmlNode.Name == "button")
     {
         string controlName = xmlNode.Attributes["caption"].Value;
         parentControls[controlName].Delete(true);
     }
 }