本文整理汇总了C#中DDay.iCal.DataTypes.iCalDateTime.AddDays方法的典型用法代码示例。如果您正苦于以下问题:C# iCalDateTime.AddDays方法的具体用法?C# iCalDateTime.AddDays怎么用?C# iCalDateTime.AddDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDay.iCal.DataTypes.iCalDateTime
的用法示例。
在下文中一共展示了iCalDateTime.AddDays方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RRULE1
public void RRULE1()
{
iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Recurrence\RRULE1.ics");
Program.TestCal(iCal);
Event evt = iCal.Events[0];
List<Occurrence> occurrences = evt.GetOccurrences(
new iCalDateTime(2006, 1, 1, tzid, iCal),
new iCalDateTime(2011, 1, 1, tzid, iCal));
iCalDateTime dt = new iCalDateTime(2006, 1, 1, 8, 30, 0, tzid, iCal);
int i = 0;
while (dt.Year < 2011)
{
if ((dt > evt.Start) &&
(dt.Year % 2 == 1) && // Every-other year from 2005
(dt.Month == 1) &&
(dt.DayOfWeek == DayOfWeek.Sunday))
{
iCalDateTime dt1 = dt.AddHours(1);
Assert.AreEqual(dt, occurrences[i].Period.StartTime, "Event should occur at " + dt);
Assert.AreEqual(dt1, occurrences[i + 1].Period.StartTime, "Event should occur at " + dt);
i += 2;
}
dt = dt.AddDays(1);
}
}
示例2: RRULE6
public void RRULE6()
{
iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Recurrence\RRULE6.ics");
Program.TestCal(iCal);
Event evt = iCal.Events[0];
List<Occurrence> occurrences = evt.GetOccurrences(
new iCalDateTime(1998, 1, 1, tzid, iCal),
new iCalDateTime(2000, 12, 31, tzid, iCal));
iCalDateTime dt = new iCalDateTime(1998, 1, 1, 9, 0, 0, tzid, iCal);
int i = 0;
while (dt.Year < 2001)
{
if (dt >= evt.Start &&
dt.Month == 1 &&
dt <= new iCalDateTime(2000, 1, 31, 9, 0, 0, tzid, iCal))
{
Assert.AreEqual(dt, occurrences[i].Period.StartTime, "Event should occur at " + dt);
i++;
}
dt = dt.AddDays(1);
}
}
示例3: RRULE3
public void RRULE3()
{
iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Recurrence\RRULE3.ics");
Program.TestCal(iCal);
Event evt = iCal.Events[0];
List<Occurrence> occurrences = evt.GetOccurrences(
new iCalDateTime(1997, 9, 1, tzid, iCal),
new iCalDateTime(1998, 1, 1, tzid, iCal));
iCalDateTime dt = new iCalDateTime(1997, 9, 2, 9, 0, 0, tzid, iCal);
int i = 0;
while (dt.Year < 1998)
{
if ((dt >= evt.Start) &&
(dt < new iCalDateTime(1997, 12, 24, 0, 0, 0, tzid, iCal)))
{
Assert.AreEqual(dt, occurrences[i].Period.StartTime, "Event should occur at " + dt);
Assert.IsTrue(
(dt < new iCalDateTime(1997, 10, 26, tzid, iCal) && dt.TimeZoneInfo.TimeZoneName == "EDT") ||
(dt > new iCalDateTime(1997, 10, 26, tzid, iCal) && dt.TimeZoneInfo.TimeZoneName == "EST"),
"Event " + dt + " doesn't occur in the correct time zone (including Daylight & Standard time zones)");
i++;
}
dt = dt.AddDays(1);
}
}