/// <summary> /// Adds the command. /// </summary> /// <param name="menuCommandService">The menu command service.</param> /// <param name="command">The command.</param> public static void AddCommand(this IMenuCommandService menuCommandService, IVsMenuCommand command) { Guard.NotNull(() => menuCommandService, menuCommandService); Guard.NotNull(() => command, command); menuCommandService.AddCommand(new VsMenuCommandAdapter(command)); }
private static CommandID GetCommandId(IVsMenuCommand command) { Guard.NotNull(() => command, command); return(new CommandID(command.Group, command.Id)); }
/// <summary> /// Initializes a new instance of the <see cref="VsMenuCommandAdapter"/> class. /// </summary> /// <param name="command">The command.</param> public VsMenuCommandAdapter(IVsMenuCommand command) : base((s, e) => command.Execute(), null, (s, e) => command.QueryStatus((IMenuCommand)s), GetCommandId(command)) { }
private static CommandID GetCommandId(IVsMenuCommand command) { Guard.NotNull(() => command, command); return new CommandID(command.Group, command.Id); }