本文整理汇总了C#中DDay.iCal.DataTypes.Date_Time.AddHours方法的典型用法代码示例。如果您正苦于以下问题:C# Date_Time.AddHours方法的具体用法?C# Date_Time.AddHours怎么用?C# Date_Time.AddHours使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDay.iCal.DataTypes.Date_Time
的用法示例。
在下文中一共展示了Date_Time.AddHours方法的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 Date_Time(2006, 1, 1, tzid, iCal),
new Date_Time(2011, 1, 1, tzid, iCal));
Date_Time dt = new Date_Time(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))
{
Date_Time 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: AddFrequency
public static Date_Time AddFrequency(Recur.FrequencyType frequency, Date_Time dt, int interval)
{
switch (frequency)
{
case Recur.FrequencyType.YEARLY: return dt.AddYears(interval);
case Recur.FrequencyType.MONTHLY: return dt.AddMonths(interval);
case Recur.FrequencyType.WEEKLY: return dt.AddDays(interval * 7);
case Recur.FrequencyType.DAILY: return dt.AddDays(interval);
case Recur.FrequencyType.HOURLY: return dt.AddHours(interval);
case Recur.FrequencyType.MINUTELY: return dt.AddMinutes(interval);
case Recur.FrequencyType.SECONDLY: return dt.AddSeconds(interval);
default: return dt;
}
}
示例3: RRULE1
public void RRULE1()
{
iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Recurrence\RRULE1.ics");
Program.TestCal(iCal);
Event evt = iCal.Events[0];
evt.Evaluate(new Date_Time(2006, 1, 1, tzid, iCal), new Date_Time(2011, 1, 1, tzid, iCal));
Date_Time dt = new Date_Time(2006, 1, 1, 8, 30, 0, tzid, iCal);
while (dt.Year < 2011)
{
if ((dt > evt.Start) &&
(dt.Year % 2 == 0) &&
(dt.Month == 1) &&
(dt.DayOfWeek == DayOfWeek.Sunday))
{
Date_Time dt1 = dt.AddHours(1);
Assert.IsTrue(evt.OccursAt(dt), "Event should occur at " + dt);
Assert.IsTrue(evt.OccursAt(dt1), "Event should occur at " + dt1);
}
else if (dt.Date != evt.Start.Date)
Assert.IsFalse(evt.OccursOn(dt), "Event should not occur on " + dt.Local.ToShortDateString());
dt = dt.AddDays(1);
}
}