Ejemplo n.º 1
0
        private CommandBarButton GetOrCreateCommandBarButton(CommandBar commandBar, Command command, Commands2 commands)
        {
            foreach (CommandBarControl control in commandBar.Controls)
            {
                CommandBarButton button = control as CommandBarButton;
                if (button != null)
                {
                    string guid;
                    int    id;
                    commands.CommandInfo(control, out guid, out id);

                    if (command.Guid == guid)
                    {
                        return(button);
                    }
                }
            }

            return((CommandBarButton)command.AddControl(commandBar, 1));
        }
        private CommandBarButton GetOrCreateCommandBarButton(CommandBar commandBar, Command command, Commands2 commands)
        {
            foreach (CommandBarControl control in commandBar.Controls)
            {
                CommandBarButton button = control as CommandBarButton;
                if (button != null)
                {
                    string guid;
                    int id;
                    commands.CommandInfo(control, out guid, out id);

                    if (command.Guid == guid)
                        return button;
                }
            }

            return (CommandBarButton)command.AddControl(commandBar, 1);
        }