public AppointmentItem CreateAppointmentPattern(string subj, int categoryId) {
AppointmentItem apt = new AppointmentItem(AppointmentType.Pattern);
apt.Start = DateTime.Today.AddHours(9);
apt.End = apt.Start.AddMinutes(5);
apt.Subject = subj;
apt.LabelId = categoryId;
return apt;
}
// An appointment is set every 10 minutes. Five occurrences.
AppointmentItem apt1 = CreateAppointmentPattern("Every 10 minutes. Five occurrences.", 0);
apt1.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt1.Start, 5).Interval(10).Build());
scheduler.AppointmentItems.Add(apt1);
// An appointment is set every 45 minutes. Infinite (no end time).
AppointmentItem apt2 = CreateAppointmentPattern("Every 45 minutes. Infinite", 0);
apt2.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt2.Start).Interval(45).Build());
scheduler.AppointmentItems.Add(apt2);
// An appointment is set every 20 minutes. The appointment chain duration is 10 hours.
AppointmentItem apt3 = CreateAppointmentPattern("Every 20 minutes. Series duration is 10 hours.", 0);
apt3.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt3.Start, apt3.Start.AddHours(10)).Interval(20).Build());
scheduler.AppointmentItems.Add(apt3);
Public Function CreateAppointmentPattern(ByVal subj As String, ByVal categoryId As Integer) As AppointmentItem
Dim apt As New AppointmentItem(AppointmentType.Pattern)
apt.Start = Date.Today.AddHours(9)
apt.End = apt.Start.AddMinutes(5)
apt.Subject = subj
apt.LabelId = categoryId
Return apt
End Function
' An appointment is set every 10 minutes. Five occurrences.
Private apt1 As AppointmentItem = CreateAppointmentPattern("Every 10 minutes. Five occurrences.", 0)
apt1.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt1.Start, 5).Interval(10).Build())
scheduler.AppointmentItems.Add(apt1)
' An appointment is set every 45 minutes. Infinite (no end time).
Dim apt2 As AppointmentItem = CreateAppointmentPattern("Every 45 minutes. Infinite", 0)
apt2.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt2.Start).Interval(45).Build())
scheduler.AppointmentItems.Add(apt2)
' An appointment is set every 20 minutes. The appointment chain duration is 10 hours.
Dim apt3 As AppointmentItem = CreateAppointmentPattern("Every 20 minutes. Series duration is 10 hours.", 0)
apt3.SetRecurrenceInfo(RecurrenceBuilder.Minutely(apt3.Start, apt3.Start.AddHours(10)).Interval(20).Build())
scheduler.AppointmentItems.Add(apt3)