XamSchedule provides the capability of specifying settings regarding which days of week are work days and what the working hours are for those days. You are also able to override work week and work hour settings for specific days. The properties for specifying these settings are exposed by the XamScheduleDataManager via its Settings property. Further, these settings may be provided for individual resources so different resources (users) can have different work days and working hours.
By default, Monday through Friday are considered to be working days and the working hours are from 9am-5pm. You can change the default working days and default working hours, via the WorkDays and WorkingHours properties of the ScheduleSettings class (exposed via the xamScheduleDataManager.Settings property). This corresponds to the options offered in Outlook where one chooses which days are work days and specifies 1 set of working hours for those days. Note: unlike Outlook, the architecture for xamSchedule allows multiple dis-contiguous ranges to be specified for working hours.
Note: Resource also exposes a DaysOfWeek property to allow specific resources to override the values set on ScheduleSettings.
The example below shows how the developer can set custom DaySettings for every Friday:
<ig:XamScheduleDataManager>
<ig:XamScheduleDataManager.Settings>
<ig:ScheduleSettings>
<ig:ScheduleSettings.DaysOfWeek>
<ig:ScheduleDaysOfWeek>
<ig:ScheduleDaysOfWeek.Friday>
<ig:ScheduleDayOfWeek>
<ig:ScheduleDayOfWeek.DaySettings>
<ig:DaySettings IsWorkday="True">
<ig:DaySettings.WorkingHours>
<ig:WorkingHoursCollection>
<ig:TimeRange Start="08:00" End="12:00" />
<ig:TimeRange Start="16:00" End="20:00" />
</ig:WorkingHoursCollection>
</ig:DaySettings.WorkingHours>
</ig:DaySettings>
</ig:ScheduleDayOfWeek.DaySettings>
</ig:ScheduleDayOfWeek>
</ig:ScheduleDaysOfWeek.Friday>
</ig:ScheduleDaysOfWeek>
</ig:ScheduleSettings.DaysOfWeek>
</ig:ScheduleSettings>
</ig:XamScheduleDataManager.Settings>
</ig:XamScheduleDataManager>
Dim range1 As New TimeRange() With { _
Key .Start = New TimeSpan(8, 0, 0), _
Key .[End] = New TimeSpan(12, 0, 0) _
}
Dim range2 As New TimeRange() With { _
Key .Start = New TimeSpan(13, 0, 0), _
Key .[End] = New TimeSpan(17, 0, 0) _
}
If dataManager.Settings.DaysOfWeek Is Nothing Then
dataManager.Settings.DaysOfWeek = _
New ScheduleDaysOfWeek()
End If
If dataManager.Settings.DaysOfWeek.Friday Is Nothing Then
dataManager.Settings.DaysOfWeek.Friday = _
New ScheduleDayOfWeek()
End If
If dataManager.Settings.DaysOfWeek.Friday.DaySettings Is Nothing Then
dataManager.Settings.DaysOfWeek.Friday.DaySettings = _
New DaySettings()
End If
dataManager.Settings.DaysOfWeek.Friday.DaySettings. _
IsWorkday = True
dataManager.Settings.DaysOfWeek.Friday.DaySettings. _
WorkingHours.Add(range1)
dataManager.Settings.DaysOfWeek.Friday.DaySettings. _
WorkingHours.Add(range2)
TimeRange range1 = new TimeRange()
{
Start = new TimeSpan(8, 0, 0),
End = new TimeSpan(12, 0, 0)
};
TimeRange range2 = new TimeRange()
{
Start = new TimeSpan(13, 0, 0),
End = new TimeSpan(17, 0, 0)
};
if (dataManager.Settings.DaysOfWeek == null)
dataManager.Settings.DaysOfWeek = new ScheduleDaysOfWeek();
if (dataManager.Settings.DaysOfWeek.Friday == null)
dataManager.Settings.DaysOfWeek.Friday =
new ScheduleDayOfWeek();
if (dataManager.Settings.DaysOfWeek.Friday.DaySettings == null)
dataManager.Settings.DaysOfWeek.Friday.DaySettings =
new DaySettings();
dataManager.Settings.DaysOfWeek.Friday.DaySettings.
IsWorkday = true;
dataManager.Settings.DaysOfWeek.Friday.DaySettings.
WorkingHours.Add(range1);
dataManager.Settings.DaysOfWeek.Friday.DaySettings.
WorkingHours.Add(range2);
In addition, developers can override these settings for a specific date (or for a series of dates defined by a recurrence pattern) by defining a DaySettingsOverride object. This can be done for the entire xamScheduleDataManager (i.e. the default for all resources) using the DaySettingsOverrides collection on the ScheduleSettings class. This can be also overridden on a specific Resource using its DaySettingsOverrides property.
Note: If the IsWorkDay property resolves to false the WorkingHoursCollection is ignored. This allows defining specific days as working days with a set of working hours but marking a specific Date as not being a working day in which case the control will not honor the working hours specified at the more general level.