/// <summary> /// Initializes a new instance of the <see cref="DailyRecurrence"/> class /// executed daily on the specified <paramref name="weekDays"/> /// at the specified <paramref name="timesOfDay"/>. /// </summary> /// <param name="behavior">The behavior regarding invalid times and ambiguous times.</param> /// <param name="weekDays">The recurrent week days (ex: every <see cref="RecurrentWeekDays.WeekEnd"/>).</param> /// <param name="timesOfDay">The times of day the recurrence is executed.</param> /// <exception cref="ArgumentException"><paramref name="behavior"/> is not specified /// -or- <paramref name="weekDays"/> is not specified /// -or- <paramref name="timesOfDay"/> is null or empty.</exception> /// <exception cref="ArgumentOutOfRangeException">One of the specified <paramref name="timesOfDay"/> is lower than 00:00:00 or greater than or equal to 1.00:00:00.</exception> public DailyRecurrence(RecurrenceBehavior behavior, RecurrentWeekDays weekDays, IEnumerable <TimeSpan> timesOfDay) : base(behavior, timesOfDay) { if (weekDays == default(RecurrentWeekDays)) { throw new ArgumentException("Non specified argument.", "weekDays"); } WeekDays = weekDays; }
/// <summary> /// Initializes a new instance of the <see cref="WeeklyRecurrence"/> class /// executed every <paramref name="weeks"/>(s) /// on the specified <paramref name="weekDays"/> /// at the specified <paramref name="timesOfDay"/>. /// </summary> /// <param name="behavior">The behavior regarding invalid times and ambiguous times.</param> /// <param name="weekDays">The recurrent week days (ex: every <see cref="RecurrentWeekDays.WeekEnd"/>).</param> /// <param name="weeks">The recurrent week(s) (ex: every 2 weeks).</param> /// <param name="timesOfDay">The times of day the recurrence is executed.</param> /// <exception cref="ArgumentException"><paramref name="behavior"/> is not specified /// -or- <paramref name="weekDays"/> is not specified /// -or- <paramref name="timesOfDay"/> is null or empty.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="weeks"/> is not strictly positive /// -or- one of the specified <paramref name="timesOfDay"/> is lower than 00:00:00 or greater than or equal to 1.00:00:00.</exception> public WeeklyRecurrence(RecurrenceBehavior behavior, RecurrentWeekDays weekDays, int weeks, IEnumerable <TimeSpan> timesOfDay) : base(behavior, timesOfDay) { if (weekDays == default(RecurrentWeekDays)) { throw new ArgumentException("Non specified argument.", "weekDays"); } if (weeks <= 0) { throw new ArgumentOutOfRangeException("weeks"); } WeekDays = weekDays; Weeks = weeks; }
/// <summary> /// Initializes a new instance of the <see cref="RecurrentWeekDaysOfMonth"/> struct. /// </summary> /// <param name="position">The position of the <paramref name="weekDays"/> in month.</param> /// <param name="weekDays">The recurrent week days (ex: every <see cref="RecurrentWeekDays.WeekEnd"/>).</param> /// <param name="anyWeekDays">If set to <c>true</c> any <paramref name="weekDays"/> is considered when determining the next occurence; otherwise, all the <paramref name="weekDays"/> are considered.</param> /// <remarks> /// When combining any <paramref name="weekDays"/> in the <see cref="WeekOfMonthPosition.Last"/> position, /// the latest date and time matching the specified <see cref="_weekDays"/> is considered. /// </remarks> public RecurrentWeekDaysOfMonth(WeekOfMonthPosition position, RecurrentWeekDays weekDays, bool anyWeekDays) { _position = position; _weekDays = weekDays; _anyWeekDays = anyWeekDays; }
/// <summary> /// Initializes a new instance of the <see cref="RecurrentWeekDaysOfMonth"/> struct /// where all <paramref name="weekDays"/> are considered when determining the next occurence. /// </summary> /// <param name="position">The position of the <paramref name="weekDays"/> in month.</param> /// <param name="weekDays">The recurrent week days (ex: every <see cref="RecurrentWeekDays.WeekEnd"/>).</param> public RecurrentWeekDaysOfMonth(WeekOfMonthPosition position, RecurrentWeekDays weekDays) : this(position, weekDays, false) { }
/// <summary> /// Initializes a new instance of the <see cref="WeeklyRecurrence"/> class /// executed every <paramref name="weeks"/>(s) /// on the specified <paramref name="weekDays"/> /// at the specified <paramref name="timesOfDay"/>. /// </summary> /// <param name="behavior">The behavior regarding invalid times and ambiguous times.</param> /// <param name="weekDays">The recurrent week days (ex: every <see cref="RecurrentWeekDays.WeekEnd"/>).</param> /// <param name="weeks">The recurrent week(s) (ex: every 2 weeks).</param> /// <param name="timesOfDay">The times of day the recurrence is executed.</param> /// <exception cref="ArgumentException"><paramref name="behavior"/> is not specified /// -or- <paramref name="weekDays"/> is not specified /// -or- <paramref name="timesOfDay"/> is null or empty.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="weeks"/> is not strictly positive /// -or- one of the specified <paramref name="timesOfDay"/> is lower than 00:00:00 or greater than or equal to 1.00:00:00.</exception> public WeeklyRecurrence(RecurrenceBehavior behavior, RecurrentWeekDays weekDays, int weeks, params TimeSpan[] timesOfDay) : this(behavior, weekDays, weeks, timesOfDay != null ? timesOfDay.AsEnumerable() : null) { }
/// <summary> /// Initializes a new instance of the <see cref="WeeklyRecurrence"/> class /// executed every <paramref name="weeks"/>(s) /// on the specified <paramref name="weekDays"/> /// at the specified <paramref name="timesOfDay"/>. /// </summary> /// <param name="weekDays">The recurrent week days (ex: every <see cref="RecurrentWeekDays.WeekEnd"/>).</param> /// <param name="weeks">The recurrent week(s) (ex: every 2 weeks).</param> /// <param name="timesOfDay">The times of day the recurrence is executed.</param> /// <exception cref="ArgumentException"><paramref name="weekDays"/> is not specified /// -or- <paramref name="timesOfDay"/> is null or empty.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="weeks"/> is not strictly positive /// -or- one of the specified <paramref name="timesOfDay"/> is lower than 00:00:00 or greater than or equal to 1.00:00:00.</exception> public WeeklyRecurrence(RecurrentWeekDays weekDays, int weeks, params TimeSpan[] timesOfDay) : this(RecurrenceBehavior.ShiftAndStandardTime, weekDays, weeks, timesOfDay != null ? timesOfDay.AsEnumerable() : null) { }