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


C# iCalDateTime.AddDays方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:28,代码来源:Recurrence.cs

示例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);
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:25,代码来源:Recurrence.cs

示例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);
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:28,代码来源:Recurrence.cs


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