예제 #1
0
        private void DailyInitRecurring(ref int schInterval, ref DailyIntervalUnit schIntervalUnit, ref Time?schStartAt,
                                        ref Time?schEndAt, ref ScheduleType schType, ref TimeSpan spanStart, ref TimeSpan spanEnd,
                                        DailyIntervalUnit intervalUnit, int interval, Time?startAt, Time?endAt,
                                        bool enabled, string description)
        {
            if (startAt.HasValue && endAt.HasValue)
            {
                if (startAt.Value >= endAt.Value)
                {
                    throw new ArgumentException("Argument endAt must be greater than argument startAt.");
                }
            }

            if (interval <= 0)
            {
                throw new ArgumentException("Argument interval must be greater than 0.");
            }

            Init(enabled, description);

            schInterval     = interval;
            schIntervalUnit = intervalUnit;
            schStartAt      = startAt;
            schEndAt        = endAt;
            schType         = ScheduleType.Recurring;

            spanStart = GetTimeSpan(startAt, 0, 0, 0);
            spanEnd   = GetTimeSpan(endAt, 23, 59, 59);
        }
예제 #2
0
 /// <summary>
 /// Sets a schedule, that will fire event through the specified interval within active period
 /// </summary>
 /// <param name="intervalUnit">Unit of the interval</param>
 /// <param name="interval">Specifies the time interval for the event to occur</param>
 /// <param name="startAt">Starting point of active period, within which event will fire. If null, it will assume begin of the day (00:00:00)</param>
 /// <param name="endAt">Ending point of active period, within which event will fire. If null, it will assume end of the day (23:59:59)</param>
 /// <param name="enabled">Flag, indicating that schedule is enabled. Disabled schedules wil not fire events</param>
 /// <param name="description">Optional description of a schedule</param>
 public DailySchedule(DailyIntervalUnit intervalUnit, int interval, Time?startAt, Time?endAt,
                      bool enabled = true, string description = null)
 {
     DailyInitRecurring(ref _interval, ref _intervalUnit, ref _startAt, ref _endAt, ref _type, ref SpanStart, ref SpanEnd,
                        intervalUnit, interval, startAt, endAt, enabled, description);
 }
예제 #3
0
 /// <summary>
 /// Sets a schedule, that will fire event on active days, through the specified interval within active period
 /// </summary>
 /// <param name="launchDays">Array of days when this schedule is active.</param>
 /// <param name="intervalUnit">Unit of the interval</param>
 /// <param name="interval">Specifies the time interval for the event to occur</param>
 /// <param name="startAt">Starting point of active period, within which event will fire. If null, it will assume begin of the day (00:00:00)</param>
 /// <param name="endAt">Ending point of active period, within which event will fire. If null, it will assume end of the day (23:59:59)</param>
 /// <param name="enabled">Flag, indicating that schedule is enabled. Disabled schedules wil not fire events</param>
 /// <param name="description">Optional description of a schedule</param>
 public WeeklySchedule(DayOfWeek[] launchDays, DailyIntervalUnit intervalUnit, int interval, Time?startAt, Time?endAt,
                       bool enabled = true, string description = null)
     : base(intervalUnit, interval, startAt, endAt, enabled, description)
 {
     InitWeeklySchedule(launchDays);
 }