示例#1
0
        public async Task ResetToAsync(TState state, CancellationToken cancellationToken = default)
        {
            var args = new FsmResetArgs <TState, TEvent>
            {
                Fsm               = this,
                PrevState         = Current,
                CancellationToken = cancellationToken,
            };

            cancellationToken.ThrowIfCancellationRequested();

            lock (_locker)
                Current = state;

            await OnReset(args).ConfigureAwait(false);
        }
示例#2
0
 private Task OnReset(FsmResetArgs <TState, TEvent> args)
 {
     return(_model.OnReset?.Invoke(args) ?? FrameworkExt.CompletedTask);
 }