コード例 #1
0
ファイル: Registry.cs プロジェクト: ych-tmumu/FluentScheduler
        /// <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));
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
ファイル: JobManager.cs プロジェクト: xiyixia/FluentScheduler
        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
            });
        }
コード例 #4
0
ファイル: JobManager.cs プロジェクト: xiyixia/FluentScheduler
        /// <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)));
        }
コード例 #5
0
 public Schedule AndThen <T>() where T : IJob
 {
     Jobs.Add(JobManager.GetJobAction <T>());
     return(this);
 }
コード例 #6
0
ファイル: Registry.cs プロジェクト: ych-tmumu/FluentScheduler
 /// <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));
 }