public override ChainedCommand And(Command command)
        {
            command.ThrowIfNull("command");

            AddCommand(command);

            return this;
        }
        public RetryCommand(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite)
        {
            command.ThrowIfNull("command");

            _command = command;
            Delay(retryDelay);
            Times(maximumAttempts);
        }
示例#3
0
        public RepeatCommand(Command command, TimeSpan repeatDelay, int totalRepeats = TotalRepeats.Infinite)
        {
            command.ThrowIfNull("command");

            _command = command;
            Delay(repeatDelay);
            Times(totalRepeats);
        }
示例#4
0
        protected override CommandResult OnExecute(CommandContext context)
        {
            _command = _commandDelegate(context);

            return _command.Execute(context);
        }
示例#5
0
 public RepeatCommand(Command command, int totalRepeats = TotalRepeats.Infinite)
     : this(command, TimeSpan.Zero, totalRepeats)
 {
 }
 public RetryCommand(Command command, double retryDelayInSeconds, int maximumAttempts = MaximumAttempts.Infinite)
     : this(command, TimeSpan.FromSeconds(retryDelayInSeconds), maximumAttempts)
 {
 }
        public void ExecuteCommand(Command command)
        {
            command.ThrowIfNull("command");

            _worldObserver.CommandExecuting(command);

            CommandResult result = command.Execute(_context);
            bool wasDeferred = result == CommandResult.Deferred;

            if (wasDeferred)
            {
                _commandList.Add(command, _worldInstance.WorldTime.Total);
            }
            else
            {
                _worldObserver.CommandExecuted(command, result);
            }
        }
        public void EnqueueCommandToExecuteAtTime(Command command, TimeSpan totalWorldTime, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commandList.Add(command, totalWorldTime, commandExecutedDelegate);
        }
        public void CancelCommand(Command command)
        {
            command.ThrowIfNull("command");

            _commandList.Remove(command);
        }
        private static void SetPaused(Command command, bool paused)
        {
            command._paused = paused;

            foreach (Command nestedCommand in command.NestedCommands)
            {
                SetPaused(nestedCommand, paused);
            }
        }
示例#11
0
 public static RetryCommand Retry(Command command, double retryDelayInSeconds, int maximumAttempts = MaximumAttempts.Infinite)
 {
     return new RetryCommand(command, retryDelayInSeconds, maximumAttempts);
 }
示例#12
0
 public static RetryCommand Retry(Command command, int maximumAttempts = MaximumAttempts.Infinite)
 {
     return new RetryCommand(command, maximumAttempts);
 }
示例#13
0
 public static RepeatCommand Repeat(Command command, TimeSpan repeatDelay, int totalRepeats = TotalRepeats.Infinite)
 {
     return new RepeatCommand(command, repeatDelay, totalRepeats);
 }
示例#14
0
 public static RepeatCommand Repeat(Command command, double repeatDelayInSeconds, int totalRepeats = TotalRepeats.Infinite)
 {
     return new RepeatCommand(command, repeatDelayInSeconds, totalRepeats);
 }
示例#15
0
 public static RepeatCommand Repeat(Command command, int totalRepeats = TotalRepeats.Infinite)
 {
     return new RepeatCommand(command, totalRepeats);
 }
示例#16
0
 public RepeatCommand(Command command, double repeatDelayInSeconds, int totalRepeats = TotalRepeats.Infinite)
     : this(command, TimeSpan.FromSeconds(repeatDelayInSeconds), totalRepeats)
 {
 }
        public void CommandExecuted(Command command, CommandResult result)
        {
            command.ThrowIfNull("command");

            _logRendererState.EnqueueCommandExecutedLogEntry(_worldTime.Total, command, result);
        }
示例#18
0
 public static RetryCommand Retry(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite)
 {
     return new RetryCommand(command, retryDelay, maximumAttempts);
 }
 public void CommandExecuting(Command command)
 {
     command.ThrowIfNull("command");
 }
示例#20
0
        public static Command Tagged(Command command, Guid tag)
        {
            command.ThrowIfNull("command");

            return command.WithTag(tag);
        }
        public virtual ChainedCommand And(Command command)
        {
            var chainedCommand = new ChainedCommand(this);

            chainedCommand.And(this);

            return chainedCommand;
        }
示例#22
0
 public static ChainedCommand Chain(Command command)
 {
     return new ChainedCommand(command);
 }
        public bool CommandQueued(Command command)
        {
            command.ThrowIfNull("command");

            return _commandList.Contains(command);
        }
        public ChainedCommand(Command command)
        {
            command.ThrowIfNull("command");

            AddCommand(command);
        }
        public void EnqueueCommandWithExecutionDelay(Command command, TimeSpan executionDelay, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commandList.Add(command, _worldInstance.WorldTime.Total + executionDelay, commandExecutedDelegate);
        }
示例#26
0
        public bool Contains(Command command)
        {
            command.ThrowIfNull("command");

            return _commands.Any(arg => arg.Command == command);
        }
 public RetryCommand(Command command, int maximumAttempts = MaximumAttempts.Infinite)
     : this(command, TimeSpan.Zero, maximumAttempts)
 {
 }
 private void AddCommand(Command command)
 {
     _originalCommands.Add(command);
 }
示例#29
0
        public void Add(Command command, TimeSpan executeAtTime, Action<CommandResult> commandExecutedDelegate = null)
        {
            command.ThrowIfNull("command");

            _commands.Add(new CommandListEntry(command, executeAtTime, commandExecutedDelegate));
        }
示例#30
0
        public void Remove(Command command)
        {
            command.ThrowIfNull("command");

            _commands.RemoveAll(arg => arg.Command == command);
            foreach (Command nestedCommand in command.NestedCommands)
            {
                Remove(nestedCommand);
            }
        }