Back to Devexpress

HolidaysHelper Class

corelibraries-devexpress-dot-xtrascheduler-dot-native-9d9094d4.md

latest3.4 KB
Original Source

HolidaysHelper Class

Provides methods used to generate appointments for the scheduler holidays.

Namespace : DevExpress.XtraScheduler.Native

Assembly : DevExpress.XtraScheduler.v25.2.Core.Desktop.dll

NuGet Package : DevExpress.Scheduler.CoreDesktop

Declaration

csharp
public static class HolidaysHelper
vb
Public Module HolidaysHelper

Remarks

Call the HolidaysHelper.CreateHolidayAppointment method to create an all-day appointment for a certain holiday or the HolidaysHelper.GenerateHolidayAppointments method to create appointments for all holidays contained in the WorkDaysCollection collection of the scheduler.

Example

If you have Microsoft® Outlook installed on your machine, it may be useful to obtain the holidays list, which is shipped with its installation. For example, if you’ve installed Microsoft Office 2013 English (United States) in default location, this file can be found in the following path:

C:\Program Files\Microsoft Office\Office15\1033\Outlook.hol

This file contains all known holidays for several countries (marked in square brackets and called as locations) in the following format:

…__[United States] 168__Christmas Day,2006/12/25 Christmas Day,2007/12/25 Christmas Day,2008/12/25 Christmas Day,2009/12/25 Christmas Day,2010/12/25 Christmas Day,2011/12/25 Christmas Day,2012/12/25 Christmas Eve,2006/12/24

XtraScheduler provides the supplementary OutlookHolidaysLoader class, which is intended to load holidays from the Outlook.hol file via its FromFile or FromStream methods. So, you may obtain a collection of days which are treated as holidays for the specified country, and add these holidays to the SchedulerControl.WorkDays collection of a Scheduler Control.

The code below demonstrates how this can be done.

csharp
OutlookHolidaysLoader loader = new OutlookHolidaysLoader();
HolidayBaseCollection holidays = loader.FromFile(OutlookHolidaysFilePath, Locations);
schedulerControl1.WorkDays.AddRange(holidays);
vb
Dim loader As New OutlookHolidaysLoader()
Dim holidays As HolidayBaseCollection = loader.FromFile(OutlookHolidaysFilePath, Locations)
schedulerControl1.WorkDays.AddRange(holidays)

Inheritance

Object HolidaysHelper

See Also

HolidaysHelper Members

DevExpress.XtraScheduler.Native Namespace