/// <summary> /// Adds the specified event to the schedule using the <see cref="ScheduledEvent.Name"/> as a key. /// </summary> /// <param name="scheduledEvent">The event to be scheduled, including the date/times the event fires and the callback</param> public void Add(ScheduledEvent scheduledEvent) { lock (_eventScheduleLock) { if (_eventSchedule != null) { _eventSchedule.Add(scheduledEvent); } else { _preInitializedEvents.Add(scheduledEvent); } } }
internal void SetEventSchedule(IEventSchedule eventSchedule) { if (eventSchedule == null) { throw new ArgumentNullException("eventSchedule"); } lock (_eventScheduleLock) { _eventSchedule = eventSchedule; foreach (var scheduledEvent in _preInitializedEvents) { _eventSchedule.Add(scheduledEvent); } } }
/// <summary> /// Sets the <see cref="IEventSchedule"/> implementation /// </summary> /// <param name="eventSchedule">The event schedule implementation to be used. This is the IRealTimeHandler</param> internal void SetEventSchedule(IEventSchedule eventSchedule) { if (eventSchedule == null) { throw new ArgumentNullException("eventSchedule"); } lock (_eventScheduleLock) { _eventSchedule = eventSchedule; // load up any events that were added before we were ready to send them to the scheduler foreach (var scheduledEvent in _preInitializedEvents) { _eventSchedule.Add(scheduledEvent); } } }