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); }
private Task OnReset(FsmResetArgs <TState, TEvent> args) { return(_model.OnReset?.Invoke(args) ?? FrameworkExt.CompletedTask); }