Пример #1
0
        public bool ProcessKey(string controlType, ICommandTarget ct, Keys keyData)
        {
            Dictionary <int, CommandID> bindings;

            if (this.KeyBindings.TryGetValue(controlType, out bindings))
            {
                if (ct != null)
                {
                    if (KeyBindings.TryGetValue(ct.GetType().FullName, out bindings))
                    {
                        CommandID cmdID;
                        if (bindings.TryGetValue((int)keyData, out cmdID))
                        {
                            return(ct.Execute(cmdID));
                        }
                    }
                    return(false);
                }
            }

            if (KeyBindings.TryGetValue("", out bindings))
            {
                CommandID cmdID;
                if (bindings.TryGetValue((int)keyData, out cmdID))
                {
                    if (this.target.Execute(cmdID))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #2
0
        private void item_Click(object sender, CommandMenuEventArgs e)
        {
            MenuCommand cmd = e.Item.MenuCommand;

            if (cmd != null)
            {
                target.Execute(cmd.CommandID);
            }
        }
Пример #3
0
        public bool Execute(CommandID cmdId)
        {
            ICommandTarget ct = ActiveCommandTarget();

            if (ct == null)
            {
                return(false);
            }
            return(ct.Execute(cmdId));
        }
Пример #4
0
        public CommandResult ExtendedGoOnline(ICoreObject cpu)
        {
            var  GoOnlineCommands     = new GoOnlineCommands();
            IDlc dlc_GoOnlineCommands = GoOnlineCommands as IDlc;

            dlc_GoOnlineCommands.Attach(PersistenceWorkingContext);
            ICommandTarget ict_GoOnlineCommands = GoOnlineCommands as ICommandTarget;
            ICommand       command = CommandProcessor.CreateCommand("Application.ExtendedGoOnline", new object[1]
            {
                cpu
            }, new NameObjectCollection());

            command.WorkingContext = projectWorkingContext;

            return(ict_GoOnlineCommands.Execute(command));
        }
Пример #5
0
        public void Execute(string commandName, CommandInvocationSource invocationSource)
        {
            this.OnCommandExecuting(new CommandExecutionEventArgs(commandName));
            ICommandTarget target = this.targets.GetTarget(commandName);

            if (this.feedbackService != null)
            {
                this.feedbackService.AddDataToStream2(1, this.feedbackService.GetFeedbackValue(commandName), (int)invocationSource);
            }
            if (target == null)
            {
                return;
            }
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.CommandExecute, commandName);
            target.Execute(commandName, invocationSource);
            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.CommandExecute, commandName);
            this.OnCommandExecuted(new CommandExecutionEventArgs(commandName));
        }
Пример #6
0
        public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var commandId = new CommandID(pguidCmdGroup, (int)nCmdID);

            bool isSupported = _commandTarget.HandlesCommand(commandId);

            if (!isSupported)
            {
                return(NextCommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut));
            }

            try {
                _commandTarget.Execute(commandId);
                return(VSConstants.S_OK);
            }
            catch (Exception e) {
                Logger.LogException(e, "Error executing editor command.");
                return(Marshal.GetHRForException(e));
            }
        }
        public CommandResult GoOnlineCommands_Excute(ICommand command)
        {
            ICommandTarget ict = GoOnlineCommands as ICommandTarget;

            return(ict.Execute(command));
        }
Пример #8
0
 void ICommand.Execute(object parameter) => commandTarget.Execute(group, cmdId);