バージョン

DateRecurrence コンストラクタ(DateTime)

DateRecurrence オブジェクトの新しいインスタンスを作成します。
シンタックス
'宣言
 
Public Function New( _
   ByVal rangeStartDate As Date _
)
public DateRecurrence( 
   DateTime rangeStartDate
)

パラメータ

rangeStartDate
RangeStartDate プロパティの初期値。
使用例
Imports System.Collections.Generic
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

        '  Add a new Owner to the Owners collection
        Dim myOwner As Owner = Me.calendarInfo.Owners.Add("myCalendar")

        '  Create a DateRecurrence object for the first weekday of each month,
        '  beginning on the first day of the current year.
        Dim firstOfMonth As DateRecurrence = New DateRecurrence(New DateTime(DateTime.Today.Year, 1, 1))

        '  Make the recurrence only span the current year.
        firstOfMonth.RangeEndDate = New DateTime(DateTime.Today.Year, 12, 31)

        '  Set the pattern properties for the recurrence.
        firstOfMonth.PatternFrequency = RecurrencePatternFrequency.Monthly
        firstOfMonth.PatternType = RecurrencePatternType.Calculated
        firstOfMonth.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.First
        firstOfMonth.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays

        '  Create an OwnerRecurringDateSettings object using the new recurrence.
        Dim firstOfMonthSettings As OwnerRecurringDateSettings = New OwnerRecurringDateSettings(firstOfMonth)

        '  Specify the working hours for the first weekday of each month
        '  as 8AM to 4:30PM.
        firstOfMonthSettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(8), TimeSpan.FromHours(16.5)))

        '  Now create a DateRecurrence object that will occur on every other Friday
        Dim everyOtherFriday As DateRecurrence = New DateRecurrence(New DateTime(DateTime.Today.Year, 1, 1))

        '  Make the recurrence only span the current year.
        everyOtherFriday.RangeEndDate = New DateTime(DateTime.Today.Year, 12, 31)

        '  Set the pattern properties for the recurrence.
        everyOtherFriday.PatternFrequency = RecurrencePatternFrequency.Weekly
        everyOtherFriday.PatternInterval = 2
        everyOtherFriday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday

        '  Create an OwnerRecurringDateSettings object using the new recurrence.
        Dim everyOtherFridaySettings As OwnerRecurringDateSettings = New OwnerRecurringDateSettings(everyOtherFriday)

        '  Specify the working hours for every other Friday as 9AM to 3PM.
        everyOtherFridaySettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(9), TimeSpan.FromHours(15)))

        '  Now create a DateRecurrence object that will occur every weekday
        Dim everyWeekday As DateRecurrence = New DateRecurrence(New DateTime(DateTime.Today.Year, 1, 1))

        '  Make the recurrence only span the current year.
        everyWeekday.RangeEndDate = New DateTime(DateTime.Today.Year, 12, 31)

        '  Set the pattern properties for the recurrence.
        everyWeekday.PatternFrequency = RecurrencePatternFrequency.Daily
        everyWeekday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays

        '  Create an OwnerRecurringDateSettings object using the new recurrence.
        Dim everyWeekdaySettings As OwnerRecurringDateSettings = New OwnerRecurringDateSettings(everyWeekday)

        '  Specify the working hours for every weekday as 9AM to 5:30PM
        everyWeekdaySettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(9), TimeSpan.FromHours(17.5)))

        '  Now add each of the three OwnerRecurringDateSettings objects to the Owner's
        '  RecurringDateSettings collection. Note that the order in which they are added
        '  is important; as a rule, the one that generates the fewest occurences should
        '  be added first. This is because when the working hours are defined by the
        '  WorkingHours collection, any range of time that does not appear in the collection
        '  is considered to fall within the non-working hour range, i.e., the resolution
        '  process ends there.
        '
        '  In this example, If we don't add the monthly and weekly recurrences before
        '  the daily one, the daily one will generate occurrences on the first weekday
        '  of every month and every other Friday, superceding the monthly and weekly recurrences.
        myOwner.RecurringDateSettings.Add(firstOfMonthSettings)
        myOwner.RecurringDateSettings.Add(everyOtherFridaySettings)
        myOwner.RecurringDateSettings.Add(everyWeekdaySettings)
using System.Collections.Generic;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;

    //  Create a DateRecurrence object for the first weekday of each month,
    //  beginning on the first day of the current year.
    DateRecurrence firstOfMonth = new DateRecurrence( new DateTime(DateTime.Today.Year, 1, 1) );

    //  Make the recurrence only span the current year.
    firstOfMonth.RangeEndDate = new DateTime(DateTime.Today.Year, 12, 31);

    //  Set the pattern properties for the recurrence.
    firstOfMonth.PatternFrequency = RecurrencePatternFrequency.Monthly;
    firstOfMonth.PatternType = RecurrencePatternType.Calculated;
    firstOfMonth.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.First;
    firstOfMonth.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays;

    //  Create an OwnerRecurringDateSettings object using the new recurrence.
    OwnerRecurringDateSettings firstOfMonthSettings = new OwnerRecurringDateSettings( firstOfMonth );

    //  Specify the working hours for the first weekday of each month
    //  as 8AM to 4:30PM.
    firstOfMonthSettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(8), TimeSpan.FromHours(16.5) ) );

    //  Now create a DateRecurrence object that will occur on every other Friday
    DateRecurrence everyOtherFriday = new DateRecurrence( new DateTime(DateTime.Today.Year, 1, 1) );

    //  Make the recurrence only span the current year.
    everyOtherFriday.RangeEndDate = new DateTime(DateTime.Today.Year, 12, 31);

    //  Set the pattern properties for the recurrence.
    everyOtherFriday.PatternFrequency = RecurrencePatternFrequency.Weekly;
    everyOtherFriday.PatternInterval = 2;
    everyOtherFriday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday;

    //  Create an OwnerRecurringDateSettings object using the new recurrence.
    OwnerRecurringDateSettings everyOtherFridaySettings = new OwnerRecurringDateSettings( everyOtherFriday );

    //  Specify the working hours for every other Friday as 9AM to 3PM.
    everyOtherFridaySettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(9), TimeSpan.FromHours(15) ) );

    //  Now create a DateRecurrence object that will occur every weekday
    DateRecurrence everyWeekday = new DateRecurrence( new DateTime(DateTime.Today.Year, 1, 1) );

    //  Make the recurrence only span the current year.
    everyWeekday.RangeEndDate = new DateTime(DateTime.Today.Year, 12, 31);

    //  Set the pattern properties for the recurrence.
    everyWeekday.PatternFrequency = RecurrencePatternFrequency.Daily;
    everyWeekday.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays;

    //  Create an OwnerRecurringDateSettings object using the new recurrence.
    OwnerRecurringDateSettings everyWeekdaySettings = new OwnerRecurringDateSettings( everyWeekday );

    //  Specify the working hours for every weekday as 9AM to 5:30PM
    everyWeekdaySettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(9), TimeSpan.FromHours(17.5) ) );

    //  Now add each of the three OwnerRecurringDateSettings objects to the Owner's
    //  RecurringDateSettings collection. Note that the order in which they are added
    //  is important; as a rule, the one that generates the fewest occurences should
    //  be added first. This is because when the working hours are defined by the
    //  WorkingHours collection, any range of time that does not appear in the collection
    //  is considered to fall within the non-working hour range, i.e., the resolution
    //  process ends there.
    //
    //  In this example, If we don't add the monthly and weekly recurrences before
    //  the daily one, the daily one will generate occurrences on the first weekday
    //  of every month and every other Friday, superceding the monthly and weekly recurrences.
    myOwner.RecurringDateSettings.Add( firstOfMonthSettings );
    myOwner.RecurringDateSettings.Add( everyOtherFridaySettings );
    myOwner.RecurringDateSettings.Add( everyWeekdaySettings );
参照