/// <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));
        }
예제 #2
0
        private static CommandID GetCommandId(IVsMenuCommand command)
        {
            Guard.NotNull(() => command, command);

            return(new CommandID(command.Group, command.Id));
        }
예제 #3
0
 /// <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))
 {
 }
예제 #4
0
        private static CommandID GetCommandId(IVsMenuCommand command)
        {
            Guard.NotNull(() => command, command);

            return new CommandID(command.Group, command.Id);
        }
예제 #5
0
 /// <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))
 {
 }