DotNetBar for Windows Forms提供了日历日程控件,在使用日历日程控件时经常需要知道两个时间段之间到底有哪些任务,Schedule为开发人员提供了方法可枚举出两个时间点之间的所有任务安排,具体代码如下:
DateTime start = new DateTime(2014, 05, 07);
DateTime end = start.AddDays(10);
DateTime d = start;
while (d <= end)
{
DevComponents.Schedule.Model.Day day = calendarView1.CalendarModel.GetDay(d);
foreach (Appointment item in day.Appointments)
{
Console.WriteLine("Appointment: {0}-{1} {2}", item.StartTime, item.EndTime, item.Subject);
}
d = d.AddDays(1);
}