'宣言 Public Property Recurrence As AppointmentRecurrence
public AppointmentRecurrence Recurrence {get; set;}
このプロパティから null 以外の値を返すのは、AppointmentRecurrence の AppointmentRecurrence.RootAppointment である Appointment オブジェクトのみです。「単独の」予定とバリアンス (定期的な予定の変更されたメンバー) はどちらも、このプロパティから null を返します。
注: 既存の AppointmentRecurrence オブジェクトの AppointmentRecurrence.Variances コレクションのメンバーである Appointment の Recurrence プロパティを設定しようとすると、例外がスローされます。同様に、すでに他の Appointment オブジェクトの Recurrence プロパティに割り当てられている AppointmentRecurrence オブジェクトを設定しようとすると、例外がスローされます。また、Recurrence プロパティが設定されている Appointment の StartDateTime プロパティまたは EndDateTime プロパティを設定したときにも、例外がスローされます。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Sub CreateAllRecurringAppointments() ' The 'PatternFrequency' is used to indicate how often the ' recurrence will occur. The options are daily, weekly, ' monthly and yearly. ' ' A daily recurrence can either occur every x number ' of days or occur every weekday ' Dim dt As DateTime = DateTime.Now Dim endDt As DateTime = dt.AddHours(3D) Dim dailyAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, endDt, "") ' create the recurrence object dailyAppt.Recurrence = New AppointmentRecurrence() ' This will be a daily recurrence that will occur ' each weekday dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily ' In this case, we use the 'PatternDaysOfWeek' to ' indicate that the daily occurrences should fall ' on every weekday (each day but saturday and sunday). dailyAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays dailyAppt.Subject = "Occurs every weekday" Dim dailyAppt2 As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, endDt, "") dailyAppt2.Recurrence = New AppointmentRecurrence() ' This will be a daily recurrence... dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily ' occur every 3 days dailyAppt2.Recurrence.PatternInterval = 3 dailyAppt2.Subject = "Occurs every 3 days" ' A weekly recurrence will occur every x number of ' weeks on particular days of the week ' Dim weekAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, endDt, "") weekAppt.Recurrence = New AppointmentRecurrence() ' the 'PatternFrequency' indicates the frequency of the recurrence. weekAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Weekly ' the recurrence should occur every other week weekAppt.Recurrence.PatternInterval = 2 ' The 'PatternDaysOfWeek' specifies which days weekAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Tuesday Or _ RecurrencePatternDaysOfWeek.Friday weekAppt.Subject = "Occurs Tuesday and Friday of every other week." ' A monthly recurrence will occur either on a ' specific day number of every x number of months ' or it will need to be calculated and will occur ' relative to the specified occurence days of ' week and day in month pattern. ' ' For a calculated monthly recurrence, the 'PatternDaysOfWeek' ' is used in conjuction with the 'PatternInterval' and ' and 'PatternOccurrenceOfDayInMonth'. ' Dim mthAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, endDt, "") mthAppt.Recurrence = New AppointmentRecurrence() ' this will be a monthly recurrence mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly ' the appointment will occur every other month so we specify ' a patterninterval of 2 mthAppt.Recurrence.PatternInterval = 2 ' to have an appt occur based on a particular pattern, ' the patterntype must be set to calculated. mthAppt.Recurrence.PatternType = RecurrencePatternType.Calculated ' then you need to specify the calculation. mthAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last mthAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays ' we could have also specified a particular day ' e.g. ' appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday; mthAppt.Subject = "A monthly recurrence that occurs the last weekday of every other month" ' For an explicit monthly recurrence, the 'PatternInterval' ' and 'PatternDayOfMonth' are used to determine when the ' occurrences begin Dim mthAppt2 As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, endDt, "") ' create the recurrence object - see above for more mthAppt2.Recurrence = New AppointmentRecurrence() ' this will be a monthly recurrence mthAppt2.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly ' the appointment will occur every month mthAppt2.Recurrence.PatternInterval = 1 ' the occurrences should start on the mthAppt2.Recurrence.PatternDayOfMonth = 15 mthAppt2.Subject = "Occurs on the 15th day of every month" ' A yearly recurrence will occur either on a specific ' day of a specific month (explicit pattern type) or ' on a specific month where the day in the month ' is calculated based on the specified day of week ' and day in month pattern. ' ' For a calculated yearly recurrence, the 'PatternDaysOfWeek', ' 'PatternOccurrenceOfDayInMonth' and 'PatternMonthOfYear' ' are used. ' Dim yrAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, "") yrAppt.Recurrence = New AppointmentRecurrence() ' this is a yearly occurrence yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly ' to have an appt occur based on a particular pattern (first, second, ' last, etc.) the patterntype must be set to calculated. yrAppt.Recurrence.PatternType = RecurrencePatternType.Calculated yrAppt.Recurrence.PatternMonthOfYear = 11 ' its the fourth thursday so specify fourth... yrAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Fourth ' and it falls on thursday... yrAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Thursday yrAppt.Subject = "Thanksgiving" ' For an explicit yearly recurrence, the 'PatternDayOfMonth' ' and 'PatternMonthOfYear' are used. ' Dim yrAppt2 As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, "") yrAppt2.Recurrence = New AppointmentRecurrence() ' this is a yearly occurrence yrAppt2.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly yrAppt2.Recurrence.PatternMonthOfYear = 12 yrAppt2.Recurrence.PatternDayOfMonth = 25 yrAppt2.Subject = "Christmas" End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void CreateAllRecurringAppointments() { // The 'PatternFrequency' is used to indicate how often the // recurrence will occur. The options are daily, weekly, // monthly and yearly. // // A daily recurrence can either occur every x number // of days or occur every weekday // #region Daily DateTime dt = DateTime.Now; DateTime endDt = dt.AddHours(3d); Appointment dailyAppt = this.ultraCalendarInfo1.Appointments.Add(dt, endDt, ""); // create the recurrence object dailyAppt.Recurrence = new AppointmentRecurrence(); // This will be a daily recurrence that will occur // each weekday dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily; // In this case, we use the 'PatternDaysOfWeek' to // indicate that the daily occurrences should fall // on every weekday (each day but saturday and sunday). dailyAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays; dailyAppt.Subject = "Occurs every weekday"; Appointment dailyAppt2 = this.ultraCalendarInfo1.Appointments.Add(dt, endDt, ""); dailyAppt2.Recurrence = new AppointmentRecurrence(); // This will be a daily recurrence... dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily; // occur every 3 days dailyAppt2.Recurrence.PatternInterval = 3; dailyAppt2.Subject = "Occurs every 3 days"; #endregion //Daily // A weekly recurrence will occur every x number of // weeks on particular days of the week // #region Weekly Appointment weekAppt = this.ultraCalendarInfo1.Appointments.Add(dt, endDt, ""); weekAppt.Recurrence = new AppointmentRecurrence(); // the 'PatternFrequency' indicates the frequency of the recurrence. weekAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Weekly; // the recurrence should occur every other week weekAppt.Recurrence.PatternInterval = 2; // The 'PatternDaysOfWeek' specifies which days weekAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Tuesday | RecurrencePatternDaysOfWeek.Friday; weekAppt.Subject = "Occurs Tuesday and Friday of every other week."; #endregion //Weekly // A monthly recurrence will occur either on a // specific day number of every x number of months // or it will need to be calculated and will occur // relative to the specified occurence days of // week and day in month pattern. // #region Monthly // For a calculated monthly recurrence, the 'PatternDaysOfWeek' // is used in conjuction with the 'PatternInterval' and // and 'PatternOccurrenceOfDayInMonth'. // Appointment mthAppt = this.ultraCalendarInfo1.Appointments.Add(dt, endDt, ""); mthAppt.Recurrence = new AppointmentRecurrence(); // this will be a monthly recurrence mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly; // the appointment will occur every other month so we specify // a patterninterval of 2 mthAppt.Recurrence.PatternInterval = 2; // to have an appt occur based on a particular pattern, // the patterntype must be set to calculated. mthAppt.Recurrence.PatternType = RecurrencePatternType.Calculated; // then you need to specify the calculation. mthAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last; mthAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays; // we could have also specified a particular day // e.g. // appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday; mthAppt.Subject = "A monthly recurrence that occurs the last weekday of every other month"; // For an explicit monthly recurrence, the 'PatternInterval' // and 'PatternDayOfMonth' are used to determine when the // occurrences begin Appointment mthAppt2 = this.ultraCalendarInfo1.Appointments.Add(dt, endDt, ""); // create the recurrence object - see above for more mthAppt2.Recurrence = new AppointmentRecurrence(); // this will be a monthly recurrence mthAppt2.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly; // the appointment will occur every month mthAppt2.Recurrence.PatternInterval = 1; // the occurrences should start on the mthAppt2.Recurrence.PatternDayOfMonth = 15; mthAppt2.Subject = "Occurs on the 15th day of every month"; #endregion //Monthly // A yearly recurrence will occur either on a specific // day of a specific month (explicit pattern type) or // on a specific month where the day in the month // is calculated based on the specified day of week // and day in month pattern. // #region Yearly // For a calculated yearly recurrence, the 'PatternDaysOfWeek', // 'PatternOccurrenceOfDayInMonth' and 'PatternMonthOfYear' // are used. // Appointment yrAppt = this.ultraCalendarInfo1.Appointments.Add(dt, ""); yrAppt.Recurrence = new AppointmentRecurrence(); // this is a yearly occurrence yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly; // to have an appt occur based on a particular pattern (first, second, // last, etc.) the patterntype must be set to calculated. yrAppt.Recurrence.PatternType = RecurrencePatternType.Calculated; yrAppt.Recurrence.PatternMonthOfYear = 11; // its the fourth thursday so specify fourth... yrAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Fourth; // and it falls on thursday... yrAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Thursday; yrAppt.Subject = "Thanksgiving"; // For an explicit yearly recurrence, the 'PatternDayOfMonth' // and 'PatternMonthOfYear' are used. // Appointment yrAppt2 = this.ultraCalendarInfo1.Appointments.Add(dt, ""); yrAppt2.Recurrence = new AppointmentRecurrence(); // this is a yearly occurrence yrAppt2.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly; yrAppt2.Recurrence.PatternMonthOfYear = 12; yrAppt2.Recurrence.PatternDayOfMonth = 25; yrAppt2.Subject = "Christmas"; #endregion //Yearly }