public Task PostExecute(EventContext <TInstance> context) { if (_eventCache.TryGetValue(context.Event.Name, out var stateMachineEvent) && !stateMachineEvent.IsTransitionEvent) { return(_observer.PostExecute(context)); } return(TaskUtil.Completed); }
public Task PostExecute(EventContext <TInstance> context) { if (_event.Equals(context.Event)) { return(_observer.PostExecute(context)); } return(TaskUtil.Completed); }
async Task State <TInstance> .Raise(EventContext <TInstance> context) { ActivityBehaviorBuilder <TInstance> activities; if (!_behaviors.TryGetValue(context.Event, out activities)) { StateEventFilter <TInstance> filter; if (_ignoredEvents.TryGetValue(context.Event, out filter) && filter.Filter(context)) { return; } if (_superState != null) { try { await _superState.Raise(context); return; } catch (UnhandledEventException) { // the exception is better if it's from the substate } } await _machine.UnhandledEvent(context, this); return; } try { await _observer.PreExecute(context); await activities.Behavior.Execute(new EventBehaviorContext <TInstance>(context)); await _observer.PostExecute(context); } catch (Exception ex) { await _observer.ExecuteFault(context, ex); throw; } }