protected BaseCommand(OleMenuCommandService commandService,
                              ICommandAvailabilityService commandAvailabilityService,
                              int commandId,
                              Guid commandSet)
        {
            if (commandService == null)
            {
                throw new ArgumentNullException(nameof(commandService));
            }
            if (commandAvailabilityService == null)
            {
                throw new ArgumentNullException(nameof(commandAvailabilityService));
            }

            var menuCommandId = new CommandID(commandSet, commandId);
            var menuItem      = new OleMenuCommand(Execute, menuCommandId);

            menuItem.BeforeQueryStatus += (sender,
                                           args) =>
            {
                commandAvailabilityService.HandleCommandAvailability(b => menuItem.Visible = b,
                                                                     b => menuItem.Enabled = b);
            };

            commandService.AddCommand(menuItem);
        }
 internal BaseCommandTestImplementation(OleMenuCommandService commandService,
                                        ICommandAvailabilityService commandAvailabilityService,
                                        int commandId,
                                        Guid commandSet)
     : base(commandService, commandAvailabilityService, commandId, commandSet)
 {
 }
Exemple #3
0
 public ConfigurationWindowCommand(SSDTLifecycleExtensionPackage package,
                                   OleMenuCommandService commandService,
                                   ICommandAvailabilityService commandAvailabilityService,
                                   ToolWindowInitializer toolWindowInitializer)
     : base(package,
            commandService,
            commandAvailabilityService,
            CommandId,
            CommandSet,
            toolWindowInitializer)
 {
 }
 protected WindowBaseCommand(SSDTLifecycleExtensionPackage package,
                             OleMenuCommandService commandService,
                             ICommandAvailabilityService commandAvailabilityService,
                             int commandId,
                             Guid commandSet,
                             ToolWindowInitializer toolWindowInitializer)
     : base(commandService,
            commandAvailabilityService,
            commandId,
            commandSet)
 {
     _package = package ?? throw new ArgumentNullException(nameof(package));
     _toolWindowInitializer = toolWindowInitializer ?? throw new ArgumentNullException(nameof(toolWindowInitializer));
 }