public void onBeforeEvent(ref object data, EFAction action) { if (BeforeEvent != null) { BeforeEvent.Invoke(this, new EFEventArgs(ref data, action)); } }
public void Run() { var x = BeforeEvent?.Invoke(); Console.WriteLine($"Trigger Run Slepping {x} miliseconds"); Thread.Sleep(x ?? 1000); AfterEvent?.Invoke(); }
internal JournalEvent ExecuteEvent(string eventName, string json) { var rawEvent = new OriginalEvent { EventName = eventName, Source = json }; BeforeEvent?.Invoke(this, rawEvent); if (rawEvent.Ignore) { return(null); } if (_cache.Value.TryGetValue(eventName, out var eventCacheItem)) { JournalEvent @event = null; try { @event = (JournalEvent)eventCacheItem.Execute.Invoke(null, new object[] { json, this }); } catch (Exception exception) { LogJournalException(new JournalRecordException(json, exception)); } if (@event != null) { AllEvents?.Invoke(this, new ProcessedEvent { EventName = eventCacheItem.Name, EventType = eventCacheItem.Type, Event = @event }); } return(@event); } LogJournalWarning(new JournalEventNotFoundException(eventName, json)); return(null); }
protected virtual void OnBefore(RepositoryEventArgs args) { BeforeEvent?.Invoke(this, args); }