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


C# DataTypes.Date_Time类代码示例

本文整理汇总了C#中DDay.iCal.DataTypes.Date_Time的典型用法代码示例。如果您正苦于以下问题:C# Date_Time类的具体用法?C# Date_Time怎么用?C# Date_Time使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Period

 public Period(Date_Time start, TimeSpan duration)
     : this()
 {
     StartTime = start;
     Duration = new Duration(duration);            
     EndTime = start + duration;
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:7,代码来源:Period.cs

示例2: Period

 public Period(DateTime start, DateTime end)
     : this()
 {
     StartTime = new Date_Time(start);
     EndTime = new Date_Time(end);
     Duration = new Duration(start - end);
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:7,代码来源:Period.cs

示例3: TryParse

 public override bool TryParse(string value, ref object obj)
 {
     string[] values = value.Split(',');
     foreach (string v in values)
     {
         object dt = new Date_Time();
         object p = new Period();
         
         //
         // Set the iCalendar for each Date_Time object here,
         // so that any time zones applied to these objects will be
         // handled correctly.
         // NOTE: fixes RRULE30 eval, where EXDATE references a 
         // DATE-TIME without a time zone; therefore, the time zone
         // is implied from DTSTART, and would fail to do a proper
         // time zone lookup, because it wasn't assigned an iCalendar
         // object.
         //
         if (((Date_Time)dt).TryParse(v, ref dt))
         {
             ((Date_Time)dt).iCalendar = iCalendar;
             ((Date_Time)dt).TZID = TZID;
             Items.Add(dt);
         }
         else if (((Period)p).TryParse(v, ref p))
         {
             ((Period)p).StartTime.iCalendar = ((Period)p).EndTime.iCalendar = iCalendar;
             ((Period)p).StartTime.TZID = ((Period)p).EndTime.TZID = TZID;
             Items.Add(p);
         }
         else return false;
     }
     return true;
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:34,代码来源:RDate.cs

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

示例5: TestAlarm

        public void TestAlarm(string Calendar, List<Date_Time> Dates, Date_Time Start, Date_Time End)
        {
            iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Alarm\" + Calendar);
            Program.TestCal(iCal);
            Event evt = (Event)iCal.Events[0];

            Start.iCalendar = iCal;
            Start.TZID = tzid;
            End.iCalendar = iCal;
            End.TZID = tzid;

            evt.Evaluate(Start, End);

            for (int i = 0; i < Dates.Count; i++)
            {
                Dates[i].TZID = tzid;
                Dates[i].iCalendar = iCal;
            }

            // Poll all alarms that occurred between Start and End
            List<DDay.iCal.Components.Alarm.AlarmOccurrence> alarms = evt.PollAlarms();

            foreach (DDay.iCal.Components.Alarm.AlarmOccurrence alarm in alarms)
                Assert.IsTrue(Dates.Contains(alarm.DateTime), "Alarm triggers at " + alarm.DateTime + ", but it should not.");
            Assert.IsTrue(Dates.Count == alarms.Count, "There were " + alarms.Count + " alarm occurrences; there should have been " + Dates.Count + ".");
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:26,代码来源:Alarm.cs

示例6: Evaluate

        public override ArrayList Evaluate(Date_Time FromDate, Date_Time ToDate)
        {
            // Add the event itself, before recurrence rules are evaluated
            if (DTStart != null)
                DateTimes.Add(DTStart);

            return base.Evaluate(FromDate, ToDate);
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:8,代码来源:Todo.cs

示例7: Date_TimeUTCSerializer

        public Date_TimeUTCSerializer(Date_Time dt)
            : base(dt)
        {
            // Make a copy of the Date_Time object, so we don't alter
            // the original
            DateTime = dt.Copy();

            // Set the Date_Time object to UTC time
            DateTime.SetKind(DateTimeKind.Utc);            
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:10,代码来源:Date_TimeUTCSerializer.cs

示例8: Period

 public Period(Date_Time start, Date_Time end)
     : this()
 {
     StartTime = start.Copy();
     if (end != null)
     {
         EndTime = end.Copy();
         Duration = new Duration(end.Value - start.Value);
     }            
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:10,代码来源:Period.cs

示例9: Evaluate

        public override System.Collections.Generic.List<Period> Evaluate(Date_Time FromDate, Date_Time ToDate)
        {
            if (Start != null)
            {
                Period p = new Period(Start);
                if (!Periods.Contains(p))
                    Periods.Add(p);

                return base.Evaluate(FromDate, ToDate);
            }
            return new System.Collections.Generic.List<Period>();
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:12,代码来源:Journal.cs

示例10: Date_TimeUTCSerializer

        public Date_TimeUTCSerializer(Date_Time dt)
            : base(dt)
        {
            // Make a copy of the Date_Time object, so we don't alter
            // the original
            DateTime = dt.Copy();

            // Set the Date_Time object to UTC time
            DateTime = DateTime.UTC;

            // Ensure time is serialized
            DateTime.HasTime = true;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:13,代码来源:Date_TimeUTCSerializer.cs

示例11: Date_TimeUTCSerializer

        public Date_TimeUTCSerializer(Date_Time dt)
            : base(dt)
        {
            // Make a copy of the Date_Time object, so we don't alter
            // the original
            DateTime = dt.Copy();

            // Set the Date_Time object to UTC time
            DateTime = DateTime.UTC;

            // FIXME: this is the old way we did it; remove when verified
            //DateTime.SetKind(DateTimeKind.Utc);            
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:13,代码来源:Date_TimeUTCSerializer.cs

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

示例13: IsCompleted

 /// <summary>
 /// Use this method to determine if a todo item has been completed.
 /// This takes into account recurrence items and the previous date
 /// of completion, if any.
 /// </summary>
 /// <param name="DateTime">The date and time to test.</param>
 /// <returns>True if the todo item has been completed</returns>
 public bool IsCompleted(Date_Time currDt)
 {
     if (Status == Status.COMPLETED)
     {
         foreach (Date_Time dt in DateTimes)
         {
             if (dt > Completed && // The item has recurred after it was completed
                 currDt > dt)      // and the current date is after the recurrence date.
                 return false;
         }
         return true;
     }
     return false;
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:21,代码来源:Todo.cs

示例14: Evaluate

        public ArrayList Evaluate(Date_Time StartDate, Date_Time FromDate, Date_Time EndDate)
        {
            ArrayList Periods = new ArrayList();

            if (StartDate > FromDate)
                FromDate = StartDate;

            if (EndDate < FromDate ||
                FromDate > EndDate)
                return Periods;
            
            foreach (object obj in Items)
                Periods.Add(obj);                

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

示例15: EvaluateRRule

 /// <summary>
 /// Evaulates the RRule component, and adds each specified DateTime
 /// to the <see cref="Periods"/> collection.
 /// </summary>
 /// <param name="FromDate">The beginning date of the range to evaluate.</param>
 /// <param name="ToDate">The end date of the range to evaluate.</param>
 protected void EvaluateRRule(Date_Time FromDate, Date_Time ToDate)
 {
     // Handle RRULEs
     if (RRule != null)
     {
         foreach (Recur rrule in RRule)
         {
             ArrayList DateTimes = rrule.Evaluate(DTStart, FromDate, ToDate);
             foreach (Date_Time dt in DateTimes)
             {                            
                 if (!this.DateTimes.Contains(dt.Value))
                     this.DateTimes.Add(dt.Value);
             }
         }
     }
 }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:22,代码来源:TimeZoneInfo.cs


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