Ejemplo n.º 1
0
 public GeneratedState(
     IState current,
     StateNode stateNode,
     IStateContext stateContext,
     ISessionStateAttributesService sessionStateAttributesService)
 {
     _current      = current;
     _stateNode    = stateNode;
     _stateContext = stateContext;
     _sessionStateAttributesService = sessionStateAttributesService;
 }
Ejemplo n.º 2
0
        public DefaultState(Type stateType, string stateName = null)
        {
            if (!typeof(IState).IsAssignableFrom(stateType))
            {
                throw new ArgumentException(nameof(stateType), $"Type must implement interface {nameof(IState)}");
            }

            if (stateName != null && string.IsNullOrWhiteSpace(stateName))
            {
                throw new ArgumentException("State name cannot be empty", nameof(stateName));
            }

            StateNode = new StateNode(stateType, $"{StateNode.StateNamePrefix}{stateName ?? stateType.Name}");
        }
Ejemplo n.º 3
0
        public IfState(Func <IStateContext, CancellationToken, Task <bool> > condition, Type stateType, string stateName = null)
        {
            if (!typeof(IState).IsAssignableFrom(stateType))
            {
                throw new ArgumentException($"Type must implement interface {nameof(IState)}", nameof(stateType));
            }

            if (stateName != null && string.IsNullOrWhiteSpace(stateName))
            {
                throw new ArgumentException("State name cannot be empty", nameof(stateName));
            }

            Condition = condition;
            StateNode = new StateNode(stateType, $"{StateNode.StateNamePrefix}{stateName ?? stateType.Name}");
        }
Ejemplo n.º 4
0
 public IfState(Func <IStateContext, bool> condition, StateNode stateNode)
     : this((context, ctk) => Task.Run(() => condition(context), ctk), stateNode)
 {
 }
Ejemplo n.º 5
0
 public IfState(Func <IStateContext, CancellationToken, Task <bool> > condition, StateNode stateNode)
 {
     Condition = condition;
     StateNode = stateNode;
 }
Ejemplo n.º 6
0
 public DefaultState(StateNode stateNode)
 {
     StateNode = stateNode;
 }