Version

WorkingHours Property (TimeSlotSettings)

Returns a collection of TimeRange objects, each of which represents a range of time that is considered to be a continuous block of working hours.
Syntax
'Declaration
 
Public ReadOnly Property WorkingHours As TimeRangesCollection
public TimeRangesCollection WorkingHours {get;}
Remarks

The WorkingHours property makes it possible to designate multiple, discontiguous ranges of time as working hours for a particular date. For example, adding 2 TimeRange instances to the list, one for 9AM to 12PM, and another for 1PM to 5PM, would define the working hours for that date such that 12PM to 1PM would remain in the non-working hour range.

When the WorkingHours collection is non-empty, its contents fully describe the working hours for the associated date/day of the week and Owner, i.e., the WorkingHours collection takes precedence over any other properties that define working hours, namely the WorkDayStartTime and WorkDayEndTime properties of the DayOfWeekSettings and DayOfWeek classes. Furthermore, as soon as one TimeRange is added to the collection, that TimeRange represents the only working hours, and replaces all other criteria. For example, consider a day which was previously considered a workday, with its working hours spanning 8AM to 5PM. If a TimeRange of 9AM to 12PM is added to the WorkingHours collection for the associated day of the week, the working hour range immediately becomes 9AM - 12PM, and no longer includes the hours which were previously considered part of the workday. As soon as working hours are defined in this manner, the developer assumes responsibility for fully defining the working hours.

It should be noted that no Appearance object is specifically defined by this class for working hours or non-working hours. The UltraDayView control and the Owner object both expose such appearances, and those appearances provide the mechanism through which the visual attributes of a TimeSlot can be customized. The WorkingHours property extends more fine-grained control over which hours should be considered "working" hours, thus limiting or expanding the set of time ranges to which these existing appearances are applied. A specific appearance can be applied to any arbitrary range of time, without regard to whether it falls within working hours, using the TimeRangeAppearances collection.

Since the WorkingHours collection is exposed by several different classes, it is possible to define working hours at various different levels, i.e., for a specific date, a day of the week, or based on a recurring date pattern. The following table details order of precedence in the property resolution process for the WorkingHours collection:

Order of precedence Resolved value
1) OwnerDateSettings If the Owner's DateSettings collection contains an entry for the date to be resolved, that entry is evaluated. If it does not, the resolution process proceeds to the next level. If explicitly populated, the contents of this collection takes precedence over all other levels of the property resolution hierarchy. If the WorkingHours collection contains one or more TimeRanges, a TimeSlot displayed for the corresponding date will exhibit the working hour appearance if the TimeSlot intersects with any of those TimeRanges, and will exhibit the non-working hour appearance otherwise.
2) CalendarDateSettings If the UltraCalendarInfo's DateSettings collection contains an entry for the date to be resolved, that entry is evaluated. If it does not, the resolution process proceeds to the next level. If explicitly populated, the contents of this collection takes precedence over all remaining levels of the property resolution hierarchy. If the WorkingHours collection contains one or more TimeRanges, a TimeSlot displayed for the corresponding date will exhibit the working hour appearance if the TimeSlot intersects with any of those TimeRanges, and will exhibit the non-working hour appearance otherwise. Note that this level is applicable independently of the owner-specific ones, i.e., with control views that do not display owners separately, the UltraCalendarInfo's DateSettings collection can still be used to define working hours for any arbitrarily selected date.
3) OwnerRecurringDateSettings If the Owner's RecurringDateSettings collection contains one or more members, each is examined to determine whether the date to be resolved coincides with the recurrence pattern defined by the Recurrence property. If it does not, the resolution process proceeds to the next level. If explicitly populated, the contents of this collection takes precedence over remaining levels of the property resolution hierarchy. If the WorkingHours collection contains one or more TimeRanges, a TimeSlot displayed for the corresponding date will exhibit the working hour appearance if the TimeSlot intersects with any of those TimeRanges, and will exhibit the non-working hour appearance otherwise.

Note that in the case where more than one recurrence generates an occurrence for the same date, precedence for that date is given to the instance closest to the beginning of the collection. For this reason it is recommended that when using multiple recurrences to define working hours, the recurrence that generates occurrences at the lowest frequency should be positioned closest to the beginning of the collection. For example, consider two recurrences, one (monthly) that occurs on "the first Monday of each month" whose working hours are defined as 10AM - 2PM, and another (daily) that occurs "every weekday" whose working hours are defined as 9AM - 3PM. The one that occurs monthly should be inserted at the beginning of the collection, and the daily one after it, otherwise (since the first Monday of the month is also a weekday) the first Monday of the month will resolve through the daily recurrence, and the working hours will resolve as 9AM - 3PM, where the intent was to resolve them as 10AM - 2PM.

4) DayOfWeekSettings

The member of the DayOfWeekSettings collection which corresponds to the date to be resolved is referenced; if the WorkingHours collection is explicitly populated, its contents take precedence over all other levels of the property resolution hierarchy. A TimeSlot displayed for the corresponding date will exhibit the working hour appearance if the TimeSlot intersects with any of those TimeRanges, and will exhibit the non-working hour appearance otherwise.

If the WorkingHours collection is empty, the WorkDayStartTime and WorkDayEndTime properties are evaluated to determine whether they have been explicitly set. If they have, a TimeSlot displayed for the corresponding date will exhibit the working hour appearance if the TimeSlot intersects with the range of time defined by the WorkDayStartTime and WorkDayEndTime properties.

5) DayOfWeek (UltraCalendarInfo) This is the final level of the property resolution hierarchy. If no other player in the resolution chain had a specific setting, this object makes the final determination. A TimeSlot displayed for this day of the week will exhibit the working hour appearance if the TimeSlot intersects with the range of time defined by the WorkDayStartTime and WorkDayEndTime properties.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also