public static List <TunableButtonTemplate> BuildCommandButtons(ExtensionManager extensionManager, string commandBarTagName) { if (null == extensionManager) { throw new ArgumentNullException(nameof(extensionManager)); } if (null == commandBarTagName) { throw new ArgumentNullException(nameof(commandBarTagName)); } var commandButtons = new List <TunableButtonTemplate>(); var commandExtensions = extensionManager.SelectExtensionInfoListByTag(commandBarTagName); commandButtons.Clear(); foreach (var commandExtension in commandExtensions) { var commandButtonTemplate = new TunableButtonTemplate(commandExtension.Name, commandExtension.Id); commandButtons.Add(commandButtonTemplate); } return(commandButtons); }
public void ApplyTemplate(TunableButtonTemplate template) { if (null == template) { throw new ArgumentNullException(nameof(template)); } Text = template.Text; Enabled = template.Enabled; _command = template.Command; }