Exemplo n.º 1
0
 private Task OnError(FsmDataArgs <TState, TEvent> args, string message, params object[] formatArgs)
 {
     return(_model.OnError?.Invoke(new FsmErrorArgs <TState, TEvent>
     {
         Fsm = this,
         Data = args.Data,
         CancellationToken = args.CancellationToken,
         Message = string.Format(message, formatArgs),
     }) ?? FrameworkExt.CompletedTask);
 }
Exemplo n.º 2
0
        private async Task OnExit(FsmDataArgs <TState, TEvent> args, TState next)
        {
            var exitArgs = new FsmExitArgs <TState, TEvent>
            {
                Fsm  = this,
                Data = args.Data,
                CancellationToken = args.CancellationToken,
                NextState         = next,
            };

            if (_model.OnExit != null)
            {
                await _model.OnExit(exitArgs).ConfigureAwait(false);
            }

            if (_model.States[Current].OnExit != null)
            {
                await _model.States[Current].OnExit(exitArgs).ConfigureAwait(false);
            }
        }