public void OnEvent(Event e)
{
if (Status == EventManagerStatus.Paused && this.stepping && (this.stepEvent == EventType.Event || this.stepEvent == e.TypeId))
{
Console.WriteLine($"{DateTime.Now} Event : {e}");
this.stepping = false;
}
EventCount++;
// Skip when this event is disabled
if (!Enabled[e.TypeId])
return;
try
{
if (Filter != null && Filter.Filter(e) == null)
return;
}
catch (Exception ex)
{
OnEvent(new OnException("EventFilter", e, ex));
}
try
{
this.gates[e.TypeId]?.Invoke(e);
}
catch (Exception ex)
{
OnEvent(new OnException("EventHandler", e, ex));
}
try
{
Dispatcher?.OnEvent(e);
}
catch (Exception ex)
{
OnEvent(new OnException("EventDispatcher", e, ex));
}
try
{
Logger?.OnEvent(e);
}
catch (Exception ex)
{
OnEvent(new OnException("EventLogger", e, ex));
}
}