/// <summary> /// Create given event args with the current running state and the event type. /// </summary> /// <param name="isRunning">The running state. Determines whether the scheduler is currently active or not.</param> /// <param name="eventType">The current lifecycle type (i.e. method that caused the event).</param> public SchedulerLifeCycleEventArgs(bool isRunning, SchedulerLifeCycleEventType eventType) { if (!Enum.IsDefined(typeof(SchedulerLifeCycleEventType), eventType)) { throw new InvalidEnumArgumentException(nameof(eventType), (int)eventType, typeof(SchedulerLifeCycleEventType)); } IsRunning = isRunning; EventType = eventType; }
/// <summary> /// Execute a lifecycle event with given parameters. /// </summary> /// <param name="eventType">The type of the event.</param> protected virtual void ExecuteEvent(SchedulerLifeCycleEventType eventType) { LifeCycleEvent?.Invoke(this, new SchedulerLifeCycleEventArgs(IsRunning, eventType)); }
/// <summary> /// Execute a lifecycle event with given parameters. /// </summary> /// <param name="eventType">The type of the event.</param> /// <param name="source">The source that is processed by this event. May be <code>null</code>.</param> protected virtual void ExecuteEvent(SchedulerLifeCycleEventType eventType, IFileSource source = null) { LifeCycleEvent?.Invoke(this, new SchedulerLifeCycleEventArgs(IsRunning, source, eventType)); }