Exemple #1
0
 private void InitialiseSchedulingService()
 {
     schedulingService            = new SchedulingService();
     schedulingService.LogFactory = new NLogFactory();
     schedulingService.At("0 3 * * *").Run <CurrenciesUpdater>(); // 3:00 UTC
     schedulingService.Start();
 }
Exemple #2
0
 /// <summary>
 /// Creates a new schedule executing once every month.
 /// </summary>
 /// <param name="service">The service to which the schedule should be added.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static SchedulePart Monthly(this SchedulingService service)
 {
     return(service.At("42 4 1 * *"));
 }
Exemple #3
0
 /// <summary>
 /// Creates a new schedule executing once every week.
 /// </summary>
 /// <param name="service">The service to which the schedule should be added.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static SchedulePart Weekly(this SchedulingService service)
 {
     return(service.At("22 4 * * 0"));
 }
Exemple #4
0
 /// <summary>
 /// Creates a new schedule executing once every day.
 /// </summary>
 /// <param name="service">The service to which the schedule should be added.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static SchedulePart Daily(this SchedulingService service)
 {
     return(service.At("02 4 * * *"));
 }
Exemple #5
0
 /// <summary>
 /// Creates a new schedule executing once every hour.
 /// </summary>
 /// <param name="service">The service to which the schedule should be added.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static SchedulePart Hourly(this SchedulingService service)
 {
     return(service.At("01 * * * *"));
 }
Exemple #6
0
        /// <summary>
        /// Creates a new schedule based on a crontab expression (eg: 0 0 * * *).
        /// Please refer to the project wiki for examples.
        /// </summary>
        /// <param name="service">The service to which the schedule should be added.</param>
        /// <param name="crontab">A crontab expression describing the schedule.</param>
        /// <returns>A part that allows chained fluent method calls.</returns>
        public static SchedulePart At(this SchedulingService service, string crontab)
        {
            var schedule = CrontabSchedule.Parse(crontab);

            return(service.At(schedule.GetNextOccurrence));
        }