Ejemplo n.º 1
0
        /// <summary>
        /// Create a SimpleScheduleBuilder set to repeat forever with a 1 minute interval.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <returns>the new SimpleScheduleBuilder</returns>
        public static SimpleScheduleBuilder RepeatMinutelyForever()
        {
            SimpleScheduleBuilder sb = Create()
                                       .WithInterval(TimeSpan.FromMinutes(1))
                                       .RepeatForever();

            return(sb);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a SimpleScheduleBuilder set to repeat forever with an interval
        /// of the given number of hours.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <returns>the new SimpleScheduleBuilder</returns>
        public static SimpleScheduleBuilder RepeatHourlyForever(int hours)
        {
            SimpleScheduleBuilder sb = Create()
                                       .WithInterval(TimeSpan.FromHours(hours))
                                       .RepeatForever();

            return(sb);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a SimpleScheduleBuilder set to repeat forever with an interval
        /// of the given number of seconds.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <returns>the new SimpleScheduleBuilder</returns>
        public static SimpleScheduleBuilder RepeatSecondlyForever(int seconds)
        {
            SimpleScheduleBuilder sb = Create()
                                       .WithInterval(TimeSpan.FromSeconds(seconds))
                                       .RepeatForever();

            return(sb);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a SimpleScheduleBuilder set to repeat the given number
        /// of times - 1  with an interval of the given number of hours.
        /// </summary>
        /// <remarks>
        /// <para>Note: Total count = 1 (at start time) + repeat count</para>
        /// </remarks>
        /// <returns>the new SimpleScheduleBuilder</returns>
        public static SimpleScheduleBuilder RepeatHourlyForTotalCount(int count, int hours)
        {
            if (count < 1)
            {
                throw new ArgumentException("Total count of firings must be at least one! Given count: " + count);
            }

            SimpleScheduleBuilder sb = Create()
                                       .WithInterval(TimeSpan.FromHours(hours))
                                       .WithRepeatCount(count - 1);

            return(sb);
        }
Ejemplo n.º 5
0
        public static TriggerBuilder WithSimpleSchedule(this TriggerBuilder triggerBuilder)
        {
            SimpleScheduleBuilder builder = SimpleScheduleBuilder.Create();

            return(triggerBuilder.WithSchedule(builder));
        }