Beispiel #1
0
        ActivityBinder <TInstance> CreateConditionalActivityBinder()
        {
            EventActivityBinder <TInstance> binder = new TriggerEventActivityBinder <TInstance>(_machine, _event, _activities);

            var conditionBinder = new ConditionalActivityBinder <TInstance>(_event, context => _filter(context), binder);

            return(conditionBinder);
        }
Beispiel #2
0
        ActivityBinder <TInstance> CreateConditionalActivityBinder()
        {
            EventActivityBinder <TInstance, TData> thenBinder = new DataEventActivityBinder <TInstance, TData>(_machine, _event, _activities);
            EventActivityBinder <TInstance, TData> elseBinder = new DataEventActivityBinder <TInstance, TData>(_machine, _event);

            var conditionBinder = new ConditionalActivityBinder <TInstance, TData>(_event, context => _filter(context), thenBinder, elseBinder);

            return(conditionBinder);
        }
        public ExceptionActivityBinder <TInstance, TException> If(StateMachineCondition <TInstance> condition,
                                                                  Func <ExceptionActivityBinder <TInstance, TException>, ExceptionActivityBinder <TInstance, TException> > activityCallback)
        {
            ExceptionActivityBinder <TInstance, TException> binder = new CatchExceptionActivityBinder <TInstance, TException>(_machine, _event);

            binder = activityCallback(binder);

            var conditionBinder = new ConditionalActivityBinder <TInstance>(_event, condition, binder);

            return(new CatchExceptionActivityBinder <TInstance, TException>(_machine, _event, _activities, conditionBinder));
        }
Beispiel #4
0
        public EventActivityBinder <TInstance, TData> IfElseAsync(StateMachineAsyncCondition <TInstance, TData> condition,
                                                                  Func <EventActivityBinder <TInstance, TData>, EventActivityBinder <TInstance, TData> > thenActivityCallback,
                                                                  Func <EventActivityBinder <TInstance, TData>, EventActivityBinder <TInstance, TData> > elseActivityCallback)
        {
            var thenBinder = GetBinder(thenActivityCallback);
            var elseBinder = GetBinder(elseActivityCallback);

            var conditionBinder = new ConditionalActivityBinder <TInstance, TData>(_event, condition, thenBinder, elseBinder);

            return(new DataEventActivityBinder <TInstance, TData>(_machine, _event, _filter, _activities, conditionBinder));
        }
Beispiel #5
0
        EventActivityBinder <TInstance> EventActivityBinder <TInstance> .If(StateMachineCondition <TInstance> condition,
                                                                            Func <EventActivityBinder <TInstance>, EventActivityBinder <TInstance> > activityCallback)
        {
            EventActivityBinder <TInstance> binder = new TriggerEventActivityBinder <TInstance>(_machine, _event);

            binder = activityCallback(binder);

            var conditionBinder = new ConditionalActivityBinder <TInstance>(_event, condition, binder);

            return(new TriggerEventActivityBinder <TInstance>(_machine, _event, _filter, _activities, conditionBinder));
        }