Пример #1
0
        private void HandleStateChange(IObservedChange<CommandBase, CommandState> b)
        {
            CommandTraces.Add(new CommandTrace { DateTime = DateTime.Now, State = b.Value });
            if (b.Value == CommandState.Successed)
            {
                SignalCommandFulfillment();
                if (!ShouldExecuteForever)
                {
                    CompleteCommand();
                }
                else
                {
                    CurrentState = CommandState.Executing;
                }
            }

            RegisterTimers(b.Value);
        }
Пример #2
0
        private void HandleStateChange(CommandState state)
        {
            CommandTraces.Add(new CommandTrace {
                DateTime = DateTime.Now, State = state
            });
            if (state == CommandState.Successed)
            {
                SignalCommandFulfillment();
                if (!ShouldExecuteForever)
                {
                    CompleteCommand();
                }
                else
                {
                    CurrentState = CommandState.Executing;
                }
            }

            RegisterTimers(state);
            _stateChangedSubject.OnNext(state);
        }