当前位置: 首页>>代码示例>>C#>>正文


C# iCalDateTime.AddDays方法代码示例

本文整理汇总了C#中iCalDateTime.AddDays方法的典型用法代码示例。如果您正苦于以下问题:C# iCalDateTime.AddDays方法的具体用法?C# iCalDateTime.AddDays怎么用?C# iCalDateTime.AddDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iCalDateTime的用法示例。


在下文中一共展示了iCalDateTime.AddDays方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ByMonth1

        public void ByMonth1()
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Recurrence\ByMonth1.ics")[0];
            ProgramTest.TestCal(iCal);
            IEvent evt = iCal.Events[0];

            IList<Occurrence> occurrences = evt.GetOccurrences(
                new iCalDateTime(1998, 1, 1, tzid),
                new iCalDateTime(2000, 12, 31, tzid));

            IDateTime dt = new iCalDateTime(1998, 1, 1, 9, 0, 0, tzid);
            int i = 0;
            while (dt.Year < 2001)
            {
                if (dt.GreaterThanOrEqual(evt.Start) &&
                    dt.Month == 1 &&
                    dt.LessThanOrEqual(new iCalDateTime(2000, 1, 31, 9, 0, 0, tzid)))
                {
                    Assert.AreEqual(dt, occurrences[i].Period.StartTime, "Event should occur at " + dt);
                    i++;
                }

                dt = dt.AddDays(1);
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:25,代码来源:RecurrenceTest.cs

示例2: YearlyComplex1

        public void YearlyComplex1()
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Recurrence\YearlyComplex1.ics")[0];
            ProgramTest.TestCal(iCal);
            IEvent evt = iCal.Events[0];
            IList<Occurrence> occurrences = evt.GetOccurrences(
                new iCalDateTime(2006, 1, 1, tzid),
                new iCalDateTime(2011, 1, 1, tzid));

            IDateTime dt = new iCalDateTime(2007, 1, 1, 8, 30, 0, tzid);
            int i = 0;

            while (dt.Year < 2011)
            {
                if ((dt.GreaterThan(evt.Start)) &&
                    (dt.Year % 2 == 1) && // Every-other year from 2005
                    (dt.Month == 1) &&
                    (dt.DayOfWeek == DayOfWeek.Sunday))
                {
                    IDateTime 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);
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:28,代码来源:RecurrenceTest.cs

示例3: DailyUntil1

        public void DailyUntil1()
        {
            IICalendar iCal = iCalendar.LoadFromFile(@"Calendars\Recurrence\DailyUntil1.ics")[0];
            ProgramTest.TestCal(iCal);
            IEvent evt = iCal.Events[0];

            IList<Occurrence> occurrences = evt.GetOccurrences(
                new iCalDateTime(1997, 9, 1, tzid),
                new iCalDateTime(1998, 1, 1, tzid));

            IDateTime dt = new iCalDateTime(1997, 9, 2, 9, 0, 0, tzid);
            int i = 0;
            while (dt.Year < 1998)
            {
                if ((dt.GreaterThanOrEqual(evt.Start)) &&
                    (dt.LessThan(new iCalDateTime(1997, 12, 24, 0, 0, 0, tzid))))
                {
                    Assert.AreEqual(dt, occurrences[i].Period.StartTime, "Event should occur at " + dt);
                    Assert.IsTrue(
                        (dt.LessThan(new iCalDateTime(1997, 10, 26, tzid)) && dt.TimeZoneName == "EDT") ||
                        (dt.GreaterThan(new iCalDateTime(1997, 10, 26, tzid)) && dt.TimeZoneName == "EST"),
                        "Event " + dt + " doesn't occur in the correct time zone (including Daylight & Standard time zones)");
                    i++;
                }

                dt = dt.AddDays(1);
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:28,代码来源:RecurrenceTest.cs


注:本文中的iCalDateTime.AddDays方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。