private async Task ExecuteAction(IAsyncExecutableAction action, DomainState currentState, CancellationToken token) { OnActionStarting(action); CurrentAction = action; try { var actionSucceeded = await action.ExecuteAsync(currentState, token); if (actionSucceeded) { OnActionCompleted(action); } else { OnActionFailed(action); } } catch (OperationCanceledException) { CurrentAction = null; } }
public Task <bool> ExecuteAsync(DomainState state, CancellationToken token) => _action.ExecuteAsync(state);