protected void RaiseScheduledItemTimeReached(T itemToPush) { Task.Run(() => { ScheduledItemTimeReachedEventArgs <T> reached = new ScheduledItemTimeReachedEventArgs <T>(itemToPush); ScheduledTimeReached?.Invoke(this, reached); }); }
public bool SetScheduler(SchedulerConfig config) { if (config == null) { return(false); } Helpers.ScheduleTask(() => { ScheduledTimeReached?.Invoke(this, new ScheduledTaskEventArgs() { Guid = config.Guid, SchedulerConfig = config }); }, config.ScheduledSpan); return(true); }
public void ScheduleForTime(DateTime targetTime, double intervalinHours, string guid) { DateTime initialTime = DateTime.Now; Timer timer = null; timer = ScheduleTask(targetTime, intervalinHours, action); void action() { if (ScheduledTimeReached != null) { ScheduledTimeReached.Invoke(this, new ScheduledTaskEventArgs() { Guid = guid, InitialTime = initialTime, ScheduledTime = targetTime, SchedulerTimer = timer }); } } }