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); }
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); }