/// <summary> /// Schedules a new job in the registry. /// </summary> /// <param name="job">Factory method creating a IJob instance to run.</param> public Schedule Schedule(Func <IJob> job) { if (job == null) { throw new ArgumentNullException("job"); } return(Schedule(JobManager.GetJobAction(job), null)); }
/// <summary> /// Schedules another job to be run with this schedule. /// </summary> /// <param name="job">Job to run.</param> public Schedule AndThen(Func <IJob> job) { if (job == null) { throw new ArgumentNullException("job"); } Jobs.Add(JobManager.GetJobAction(job)); return(this); }
public static void AddJob <T>(Action <Schedule> schedule) where T : IJob { if (schedule == null) { throw new ArgumentNullException("schedule"); } AddJob(schedule, new Schedule(JobManager.GetJobAction <T>()) { Name = typeof(T).Name }); }
/// <summary> /// Adds a job schedule to the job manager. /// </summary> /// <param name="job">Job to run.</param> /// <param name="schedule">Job schedule to add.</param> public static void AddJob(IJob job, Action <Schedule> schedule) { if (job == null) { throw new ArgumentNullException("job"); } if (schedule == null) { throw new ArgumentNullException("schedule"); } AddJob(schedule, new Schedule(JobManager.GetJobAction(job))); }
public Schedule AndThen <T>() where T : IJob { Jobs.Add(JobManager.GetJobAction <T>()); return(this); }
/// <summary> /// Schedules a new job in the registry. /// </summary> /// <typeparam name="T">Job to schedule.</typeparam> public Schedule Schedule <T>() where T : IJob { return(Schedule(JobManager.GetJobAction <T>(), typeof(T).Name)); }