Esempio n. 1
0
 protected void RaiseScheduledItemTimeReached(T itemToPush)
 {
     Task.Run(() =>
     {
         ScheduledItemTimeReachedEventArgs <T> reached = new ScheduledItemTimeReachedEventArgs <T>(itemToPush);
         ScheduledTimeReached?.Invoke(this, reached);
     });
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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
                    });
                }
            }
        }