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


C# iCalendar.Create方法代码示例

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


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

示例1: Create

        static public Todo Create(iCalendar iCal)
        {
            Todo t = (Todo)iCal.Create(iCal, "VTODO");
            t.UID = UniqueComponent.NewUID();

            return t;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:7,代码来源:Todo.cs

示例2: Create

        static public Journal Create(iCalendar iCal)
        {
            Journal j = (Journal)iCal.Create(iCal, "VJOURNAL");
            j.UID = UniqueComponent.NewUID();

            return j;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:7,代码来源:Journal.cs

示例3: UniqueComponent1

        public void UniqueComponent1()
        {
            iCalendar iCal = new iCalendar();
            Event evt = iCal.Create<Event>();

            Assert.IsNotNull(evt.UID);
            Assert.IsNotNull(evt.Created);
            Assert.IsNotNull(evt.DTStamp);
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:9,代码来源:ComponentTest.cs

示例4: Create

        static public Journal Create(iCalendar iCal)
        {
            Journal j = iCal.Create<Journal>();
            j.UID = UniqueComponent.NewUID();
            j.Created = DateTime.Now;
            j.DTStamp = DateTime.Now;

            return j;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:9,代码来源:Journal.cs

示例5: UniqueComponent1

        public void UniqueComponent1()
        {
            iCalendar iCal = new iCalendar();
            Event evt = iCal.Create<Event>();

            Assert.IsNotNull(evt.UID);
            Assert.IsNull(evt.Created); // We don't want this to be set automatically
            Assert.IsNotNull(evt.DTStamp);
        }
开发者ID:logikonline,项目名称:DDay.iCal,代码行数:9,代码来源:ComponentTest.cs

示例6: Create

        static public Todo Create(iCalendar iCal)
        {
            Todo t = (Todo)iCal.Create(iCal, "VTODO");
            t.UID = UniqueComponent.NewUID();
            t.Created = DateTime.Now;
            t.DTStamp = DateTime.Now;

            return t;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:9,代码来源:Todo.cs

示例7: Category

        [Test, Category("DDay")] //Category(("FreeBusy")]
        public void GetFreeBusyStatus1()
        {
            IICalendar iCal = new iCalendar();

            IEvent evt = iCal.Create<DDayEvent>();
            evt.Summary = "Test event";
            evt.Start = new iCalDateTime(2010, 10, 1, 8, 0, 0);
            evt.End = new iCalDateTime(2010, 10, 1, 9, 0, 0);

            IFreeBusy freeBusy = iCal.GetFreeBusy(new iCalDateTime(2010, 10, 1, 0, 0, 0), new iCalDateTime(2010, 10, 7, 11, 59, 59));
            Assert.AreEqual(FreeBusyStatus.Free, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 7, 59, 59)));
            Assert.AreEqual(FreeBusyStatus.Busy, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 8, 0, 0)));
            Assert.AreEqual(FreeBusyStatus.Busy, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 8, 59, 59)));
            Assert.AreEqual(FreeBusyStatus.Free, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 9, 0, 0)));
        }
开发者ID:alexed1,项目名称:dtrack,代码行数:16,代码来源:FreeBusyTest.cs

示例8: Test1

        public void Test1()
        {
            IICalendar iCal = new iCalendar();
            IEvent evt = iCal.Create<Event>();
            evt.Summary = "Event summary";
            evt.Start = new iCalDateTime(DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc));

            IRecurrencePattern recur = new RecurrencePattern();
            evt.RecurrenceRules.Add(recur);

            try
            {
                IList<Occurrence> occurrences = evt.GetOccurrences(DateTime.Today.AddDays(1), DateTime.Today.AddDays(2));
                Assert.Fail("An exception should be thrown when evaluating a recurrence with no specified FREQUENCY");
            }
            catch { }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:17,代码来源:RecurrenceTest.cs

示例9: GetOccurrences1

        public void GetOccurrences1()
        {
            IICalendar iCal = new iCalendar();
            IEvent evt = iCal.Create<Event>();
            evt.Start = new iCalDateTime(2009, 11, 18, 5, 0, 0);
            evt.End = new iCalDateTime(2009, 11, 18, 5, 10, 0);
            evt.RecurrenceRules.Add(new RecurrencePattern(FrequencyType.Daily));
            evt.Summary = "xxxxxxxxxxxxx";
 
            iCalDateTime previousDateAndTime = new iCalDateTime(2009, 11, 17, 0, 15, 0);
            iCalDateTime previousDateOnly = new iCalDateTime(2009, 11, 17, 23, 15, 0);
            iCalDateTime laterDateOnly = new iCalDateTime(2009, 11, 19, 3, 15, 0);
            iCalDateTime laterDateAndTime = new iCalDateTime(2009, 11, 19, 11, 0, 0);
            iCalDateTime end = new iCalDateTime(2009, 11, 23, 0, 0, 0);

            IList<Occurrence> occurrences = null;

            occurrences = evt.GetOccurrences(previousDateAndTime, end);
            Assert.AreEqual(5, occurrences.Count);

            occurrences = evt.GetOccurrences(previousDateOnly, end);
            Assert.AreEqual(5, occurrences.Count);

            occurrences = evt.GetOccurrences(laterDateOnly, end);
            Assert.AreEqual(4, occurrences.Count);

            occurrences = evt.GetOccurrences(laterDateAndTime, end);
            Assert.AreEqual(3, occurrences.Count);

            // Add ByHour "9" and "12"            
            evt.RecurrenceRules[0].ByHour.Add(9);
            evt.RecurrenceRules[0].ByHour.Add(12);

            // Clear the evaluation so we can calculate recurrences again.
            evt.ClearEvaluation();

            occurrences = evt.GetOccurrences(previousDateAndTime, end);
            Assert.AreEqual(11, occurrences.Count);

            occurrences = evt.GetOccurrences(previousDateOnly, end);
            Assert.AreEqual(11, occurrences.Count);

            occurrences = evt.GetOccurrences(laterDateOnly, end);
            Assert.AreEqual(8, occurrences.Count);

            occurrences = evt.GetOccurrences(laterDateAndTime, end);
            Assert.AreEqual(7, occurrences.Count);
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:48,代码来源:RecurrenceTest.cs

示例10: Create

 static public Event Create(iCalendar iCal)
 {
     Event evt = iCal.Create<Event>();
     return evt;
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:5,代码来源:Event.cs

示例11: TEST1

        public void TEST1()
        {
            iCalendar iCal = new iCalendar();
            Event evt = iCal.Create<Event>();
            evt.Summary = "Event summary";
            evt.Start = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc);

            Recur recur = new Recur();
            evt.AddRecurrence(recur);

            try
            {
                List<Period> periods = evt.Evaluate(DateTime.Today.AddDays(1), DateTime.Today.AddDays(2));
                Assert.Fail("An exception should be thrown when evaluating a recurrence with no specified FREQUENCY");
            }
            catch { }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:17,代码来源:Recurrence.cs

示例12: RECURPARSE6

        public void RECURPARSE6()
        {
            iCalendar iCal = new iCalendar();

            Event evt = iCal.Create<Event>();
            evt.Summary = "Test event";
            evt.Start = new Date_Time(2006, 1, 1, 9, 0, 0);
            evt.Duration = new TimeSpan(1, 0, 0);
            evt.AddRecurrence(new Recur("Every month on the first sunday, at 5:00PM, and at 7:00PM"));

            List<Occurrence> occurrences = evt.GetOccurrences(
                new Date_Time(2006, 1, 1), 
                new Date_Time(2006, 3, 31));

            Date_Time[] DateTimes = new Date_Time[]
            {
                new Date_Time(2006, 1, 1, 9, 0, 0),
                new Date_Time(2006, 1, 1, 17, 0, 0),
                new Date_Time(2006, 1, 1, 19, 0, 0),
                new Date_Time(2006, 2, 5, 17, 0, 0),
                new Date_Time(2006, 2, 5, 19, 0, 0),
                new Date_Time(2006, 3, 5, 17, 0, 0),
                new Date_Time(2006, 3, 5, 19, 0, 0)
            };

            for (int i = 0; i < DateTimes.Length; i++)
                Assert.AreEqual(DateTimes[i], occurrences[i].Period.StartTime, "Event should occur on " + DateTimes[i]);

            Assert.AreEqual(
                DateTimes.Length,
                occurrences.Count,
                "There should be exactly " + DateTimes.Length +
                " occurrences; there were " + occurrences.Count);
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:34,代码来源:Recurrence.cs

示例13: RECURPARSE1

        public void RECURPARSE1()
        {
            iCalendar iCal = new iCalendar();

            Event evt = iCal.Create<Event>();
            evt.Summary = "Test event";
            evt.Start = new Date_Time(2006, 10, 1, 9, 0, 0);
            evt.Duration = new TimeSpan(1, 0, 0);
            evt.AddRecurrence(new Recur("Every 3rd month on the last tuesday and wednesday"));

            List<Occurrence> occurrences = evt.GetOccurrences(
                new Date_Time(2006, 10, 1), 
                new Date_Time(2007, 4, 30));

            Date_Time[] DateTimes = new Date_Time[]
            {
                new Date_Time(2006, 10, 1, 9, 0, 0),
                new Date_Time(2006, 10, 25, 9, 0, 0),
                new Date_Time(2006, 10, 31, 9, 0, 0),
                new Date_Time(2007, 1, 30, 9, 0, 0),
                new Date_Time(2007, 1, 31, 9, 0, 0),
                new Date_Time(2007, 4, 24, 9, 0, 0),
                new Date_Time(2007, 4, 25, 9, 0, 0)
            };

            for (int i = 0; i < DateTimes.Length; i++)
                Assert.AreEqual(DateTimes[i], occurrences[i].Period.StartTime, "Event should occur on " + DateTimes[i]);

            Assert.AreEqual(
                DateTimes.Length,
                occurrences.Count,
                "There should be exactly " + DateTimes.Length +
                " occurrences; there were " + occurrences.Count);
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:34,代码来源:Recurrence.cs

示例14: Create

 static public Todo Create(iCalendar iCal)
 {
     Todo t = iCal.Create<Todo>();
     return t;
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:5,代码来源:Todo.cs

示例15: SERIALIZE18

        public void SERIALIZE18()
        {
            iCalendar iCal = new iCalendar();

            Event evt = iCal.Create<Event>();
            evt.Summary = "Test event title";
            evt.Start = new Date_Time(2007, 3, 19);
            evt.Start.Kind = DateTimeKind.Utc;
            evt.Duration = new TimeSpan(24, 0, 0);
            evt.Created = evt.Start.Copy();
            evt.DTStamp = evt.Start.Copy();
            evt.UID = "123456789";
            evt.IsAllDay = true;            

            Recur rec = new Recur("FREQ=WEEKLY;INTERVAL=3;BYDAY=TU,FR,SU;COUNT=4");
            evt.AddRecurrence(rec);

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            string icalString = serializer.SerializeToString();

            Assert.IsNotEmpty(icalString, "iCalendarSerializer.SerializeToString() must not be empty");

            ComponentBaseSerializer compSerializer = new ComponentBaseSerializer(evt);
            string evtString = compSerializer.SerializeToString();

            Assert.IsTrue(evtString.Equals("BEGIN:VEVENT\r\nCREATED:20070319T000000Z\r\nDTEND:20070320T000000Z\r\nDTSTAMP:20070319T000000Z\r\nDTSTART;VALUE=DATE:20070319\r\nDURATION:P1D\r\nRRULE:FREQ=WEEKLY;INTERVAL=3;COUNT=4;BYDAY=TU,FR,SU\r\nSUMMARY:Test event title\r\nUID:123456789\r\nEND:VEVENT\r\n"), "ComponentBaseSerializer.SerializeToString() serialized incorrectly");
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:27,代码来源:Serialize.cs


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