void Transition(Composer composer, TInstance instance) { composer.Execute(() => { State <TInstance> currentState = _currentStateAccessor.Get(instance); if (_toState.Equals(currentState)) { return(composer.ComposeCompleted()); } var taskComposer = new TaskComposer <TInstance>(composer.CancellationToken); if (currentState != null) { currentState.Raise(taskComposer, instance, currentState.Leave); } _toState.Raise(taskComposer, instance, _toState.BeforeEnter, currentState); ((Composer)taskComposer).Execute(() => _currentStateAccessor.Set(instance, _toState)); if (currentState != null) { currentState.Raise(taskComposer, instance, currentState.AfterLeave, _toState); } _toState.Raise(taskComposer, instance, _toState.Enter); return(taskComposer.Finish()); }); }
void Activity <TInstance, TData> .Execute(Composer composer, TInstance instance, TData value) { composer.Execute(() => { if (_filterExpression(value) == false) { return(composer.ComposeCompleted()); } return(composer.ComposeActivity(_activity, instance, value)); }); }
void Execute(Composer composer, TInstance instance) { composer.Execute(() => { CompositeEventStatus value = _property.Get(instance); value.Set(_flag); _property.Set(instance, value); if (!value.Equals(_complete)) { return(composer.ComposeCompleted()); } var taskComposer = new TaskComposer <TInstance>(composer.CancellationToken); _completeCallback(taskComposer, instance); return(taskComposer.Finish()); }); }