Example #1
0
        private void ProcessMacroNode(RibbonPanel panel, XmlNode node)
        {
            string commandName = node.Attributes["internalName"].Value;

            MacroControlDefinition controlDef =
                _Application.CommandManager.ControlDefinitions[commandName] as MacroControlDefinition;

            bool?  useLargeIcon  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "useLargeIcon");
            bool?  showText      = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "showText");
            string targetControl = XmlUtilities.GetAttributeValue <string>(node, "targetControl");
            bool?  insertBefore  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "insertBefore");
            bool?  isInSlideout  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "isInSlideout");

            bool slideout = isInSlideout.HasValue ? isInSlideout.Value : false;

            CommandControls controls = (slideout ? panel.SlideoutControls : panel.CommandControls);

            controls.AddMacro(
                controlDef,
                useLargeIcon.HasValue ? useLargeIcon.Value : false,
                showText.HasValue ? showText.Value : true,
                string.IsNullOrEmpty(targetControl) ? string.Empty : targetControl,
                insertBefore.HasValue ? insertBefore.Value : false);
        }