public void ExecutarCommand(AbstractCommand command) { if (command.CanExecute(this)) { command.Execute(this); } }
protected virtual void ExecuteCommandItem(AbstractCommand command) { _currentCommand = command; //放入执行中的命令中 _executingCommands.Add(command); AddDelegateToCommand(command); command.Execute(); }
public void Step() { if (!isRunning) { isRunning = true; AbstractCommand cmd = GetNextCommand(); if (cmd != null) { cmd.Execute(); } } }
protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); EditorContext = new SitecoreEditorContext(); Visible = EditorContext.IsValid; if (EditorContext.IsValid) { _command = new LoadStatisticsCommand(EditorContext.Item, false); _command.Execute(); } }
public void Redo(int levels) { Console.WriteLine("\n---- Redo {0} levels ", levels); // Perform redo operations for (int i = 0; i < levels; i++) { if (_current < _commands.Count - 1) { AbstractCommand command = _commands[_current++]; command.Execute(); } } }
protected virtual void ExecuteCommandsInParallel() { while (_commands.Count > 0) { AbstractCommand command = _commands.Dequeue(); if (command != null) { AddDelegateToCommand(command); command.Execute(); //立即加入执行完成的列表中 _executedCommands.Add(command); } } _isPlaying = false; InvokeComplete(); }
private string processInput(List <string> arguments) { string command = arguments[0]; arguments.RemoveAt(0); string commandName = command + "Command"; Type commandType = Assembly.GetExecutingAssembly().GetTypes() .FirstOrDefault(p => p.Name.Equals(commandName, StringComparison.OrdinalIgnoreCase)); var constructor = commandType.GetConstructor(new[] { typeof(HeroManager), typeof(List <string>) }); AbstractCommand cmd = (AbstractCommand)constructor.Invoke(new object[] { this.heroManager, arguments }); return(cmd.Execute()); }
void Update() { // Commands Execute Methods Start Here: // Jump Command execute method if (aCharacterController.isGrounded && Input.GetButton("Jump")) { keyJump.Execute(aGameObject, aCharacterController); } // Constantly moving back down towards surface after command is executed else { gravity.y -= 1 * Time.deltaTime; aCharacterController.Move(gravity * Time.deltaTime); } }
public IHandlerConfig Do <TInput, TOutput>( AbstractCommand <TInput, TOutput> command, ISerializer <TOutput> serializer) where TInput : new() where TOutput : CommandResult, new() { return(Do <TInput>(input => new SerializationBasedResponseFiller <TOutput>(serializer, "application/json", (TOutput)command.Execute(input)))); }
public void Run() { command.Execute(); }
/// <summary> /// Standard command execution. /// </summary> protected ServerResponse StandardExecution ( [NotNull] ExecutionContext context ) { Sure.NotNull(context, nameof(context)); Log.Trace(nameof(AbstractEngine) + "::" + nameof(StandardExecution)); AbstractCommand command = context.Command.ThrowIfNull(nameof(context.Command)); IrbisConnection connection = (context.Connection as IrbisConnection) .ThrowIfNull(nameof(context.Connection)); if (!command.Verify(ThrowOnVerify)) { Log.Error ( nameof(AbstractEngine) + "::" + nameof(StandardExecution) + ": " + nameof(command) + "." + nameof(command.Verify) + " failed" ); } using (new BusyGuard(connection.Busy)) { ServerResponse result = ServerResponse.GetEmptyResponse(connection); connection.Interrupted = false; try { ClientQuery query = command.CreateQuery(); if (!query.Verify(ThrowOnVerify)) { Log.Error ( nameof(AbstractEngine) + "::" + nameof(StandardExecution) + ": " + nameof(query) + "." + nameof(query.Verify) + " failed" ); } result = command.Execute(query); if (!result.Verify(ThrowOnVerify)) { Log.Error ( nameof(AbstractEngine) + "::" + nameof(StandardExecution) + ": " + nameof(result) + "." + nameof(result.Verify) + " failed" ); } command.CheckResponse(result); } catch (Exception exception) { Log.TraceException ( nameof(AbstractEngine) + "::" + nameof(StandardExecution), exception ); context.Exception = exception; OnException(context); if (!context.ExceptionHandled) { throw; } } context.Response = result; return(result); } }
protected virtual void ExecuteCommandItem(AbstractCommand command){ _currentCommand = command; //放入执行中的命令中 _executingCommands.Add(command); AddDelegateToCommand(command); command.Execute(); }