示例#1
0
        public IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console, bool allowPrompt, bool forcePrompt)
        {
            if ((PromptForParameters || forcePrompt) && allowPrompt)
            {
                CommandExecutionContext ctx        = new CommandExecutionContext(Project, command);
                CustomExecutionMode     customMode = ExecutionModeCommandService.ShowParamtersDialog(ctx, Mode, this);
                if (customMode == null)
                {
                    return(new CancelledProcessAsyncOperation());
                }
                else
                {
                    return(customMode.Execute(command, console, false, false));
                }
            }
            if (commandData != null)
            {
                foreach (KeyValuePair <string, object> cmdData in commandData)
                {
                    ExecutionCommandCustomizer cc = ExecutionModeCommandService.GetExecutionCommandCustomizer(cmdData.Key);
                    if (cc != null)
                    {
                        cc.Customize(command, cmdData.Value);
                    }
                }
            }
            ParameterizedExecutionHandler cmode = Mode.ExecutionHandler as ParameterizedExecutionHandler;

            if (cmode != null)
            {
                CommandExecutionContext ctx = new CommandExecutionContext(Project, command);
                return(cmode.Execute(command, console, ctx, Data));
            }
            else
            {
                return(Mode.ExecutionHandler.Execute(command, console));
            }
        }
示例#2
0
        public CustomExecutionMode GetConfigurationData()
        {
            CustomExecutionMode cmode = new CustomExecutionMode();

            cmode.Mode = mode;
            foreach (KeyValuePair <object, IExecutionConfigurationEditor> editor in currentEditors)
            {
                if (editor.Key is IExecutionMode)
                {
                    cmode.Data = editor.Value.Save();
                }
                else
                {
                    ExecutionCommandCustomizer customizer = (ExecutionCommandCustomizer)editor.Key;
                    cmode.SetCommandData(customizer.Id, editor.Value.Save());
                }
            }
            cmode.Name  = entryModeName.Text;
            cmode.Scope = (CustomModeScope)comboStore.Active;
            cmode.PromptForParameters = checkPrompt.Active;
            cmode.Id = data.Id;
            return(cmode);
        }