Custom schedule in Gantt Chart Library and Project Management Library for Windows Forms

If you need to define a custom Schedule object in Gantt Chart Library for Windows Forms you can only do it at the global level:

DaytimeInterval[] defaultScheduleIntervals =
    new DaytimeInterval[] { new DaytimeInterval(8, 6) }; // Starting from 8 AM, 6 hours
Dictionary<DayOfWeek, DaytimeInterval[]> specialDayOfWeekScheduleIntervals =
    new Dictionary<DayOfWeek, DaytimeInterval[]>();
specialDayOfWeekScheduleIntervals[DayOfWeek.Saturday] =
    new DaytimeInterval[] { new DaytimeInterval(8, 3) }; // 3 hours only on Saturday
specialDayOfWeekScheduleIntervals[DayOfWeek.Sunday] = DaytimeInterval.NonWorkingDay; // No work on Sunday
ganttChartView.Schedule =
    new Schedule(defaultScheduleIntervals, specialDayOfWeekScheduleIntervals, DaytimeInterval.DefaultHolidays);

If you need to define a custom Schedule object in Project Management Library for Windows Forms at Project level (you could set different Schedule objects at Task and Resource level):

Schedule mySchedule = new Schedule(); // Create a custom schedule
DayTimeIntervalCollection dayWorkTime = new DayTimeIntervalCollection(); // Create a day time interval collection
dayWorkTime.Add(new TimeInterval(9, 4)); // Add work time, starting at 9 AM, for 4 hours of time (until 1 PM)
dayWorkTime.Add(new TimeInterval(14, 4)); // Add work time, starting at 2 PM, for 4 hours of time (until 6 PM)
for (DayOfWeek dayOfWeek = DayOfWeek.Monday; dayOfWeek <= DayOfWeek.Saturday; dayOfWeek++)
    mySchedule.WeekdaySchedules[dayOfWeek] = dayWorkTime; // Set the work time for Monday to Saturday
mySchedule.HolidaySchedules[DateTime.Today.AddDays(2)] =
    new DayTimeIntervalCollection(); // Set no work time for the day after tomorrow
myProjectView.Project.Schedule = mySchedule; // Use the schedule within the project