Example #1
0
        public IScheduledJob ScheduleParameterizedJob <T>(ISchedule schedule, IParameterizedJob <T> job, T parameter, DateTime firstRun)
        {
            var scheduledJob = new ScheduledJob()
            {
                Job      = job,
                Schedule = schedule,
            };

            scheduledJob.JobTask = new Func <Task>(() => job.Start(parameter, scheduledJob.RunTime));

            queueJob(firstRun, scheduledJob);

            return(scheduledJob);
        }
Example #2
0
        public IScheduledJob ScheduleParameterizedJob <T>(ISchedule schedule, IParameterizedJob <T> job, T parameter, bool runImmediately)
        {
            var scheduledJob = new ScheduledJob()
            {
                Job      = job,
                Schedule = schedule,
            };

            scheduledJob.JobTask = new Func <Task>(() => job.Start(parameter, scheduledJob.RunTime));
            DateTime firstRun = runImmediately ? DateTime.UtcNow : schedule.NextScheduledTime(scheduledJob);

            queueJob(firstRun, scheduledJob);

            return(scheduledJob);
        }