コード例 #1
0
        /// <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))
 {
 }