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


C# iCalDateTime.Copy方法代码示例

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


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

示例1: Period

 public Period(iCalDateTime start, TimeSpan duration)
     : this()
 {
     StartTime = start.Copy();
     if (duration != TimeSpan.MinValue)
     {
         Duration = new Duration(duration);
         EndTime = start + duration;
     }            
 }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:10,代码来源:Period.cs

示例2: iCalDateTimeUTCSerializer

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

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

            // Ensure time is serialized
            DateTime.HasTime = true;                    
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:13,代码来源:iCalDateTimeUTCSerializer.cs

示例3: Evaluate

        public List<iCalDateTime> Evaluate(iCalDateTime StartDate, iCalDateTime FromDate, iCalDateTime ToDate)
        {
            List<iCalDateTime> DateTimes = new List<iCalDateTime>();
            DateTimes.AddRange(StaticOccurrences);

            // Create a temporary recurrence for populating 
            // missing information using the 'StartDate'.
            RecurrencePattern r = new RecurrencePattern();
            r.CopyFrom(this);

            // Enforce evaluation engine rules
            r.EnforceEvaluationRestrictions();

            // Fill in missing, necessary ByXXX values
            r.EnsureByXXXValues(StartDate);
                        
            // Get the occurrences
            foreach (iCalDateTime occurrence in r.GetOccurrences(StartDate, FromDate.Copy(), ToDate.Copy(), r.Count))
            {
                // NOTE:
                // Used to be DateTimes.AddRange(r.GetOccurrences(FromDate.Copy(), ToDate, r.Count))
                // By doing it this way, fixes bug #19.
                if (!DateTimes.Contains(occurrence))
                    DateTimes.Add(occurrence);
            }

            // Limit the count of returned recurrences
            if (Count != int.MinValue &&
                DateTimes.Count > Count)
                DateTimes.RemoveRange(Count, DateTimes.Count - Count);

            // Process the UNTIL, and make sure the DateTimes
            // occur between FromDate and ToDate
            for (int i = DateTimes.Count - 1; i >= 0; i--)
            {
                iCalDateTime dt = (iCalDateTime)DateTimes[i];
                if (dt > ToDate ||
                    dt < FromDate)
                    DateTimes.RemoveAt(i);
            }

            // Assign missing values
            foreach (iCalDateTime dt in DateTimes)
                dt.MergeWith(StartDate);

            // Ensure that DateTimes have an assigned time if they occur less than daily
            foreach (iCalDateTime dt in DateTimes)
            {
                if (Frequency < FrequencyType.Daily)
                    dt.HasTime = true;
            }
            
            return DateTimes;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:54,代码来源:RecurrencePattern.cs

示例4: IncrementDate

        public void IncrementDate(ref iCalDateTime dt, int Interval)
        {
            iCalDateTime old = dt.Copy();
            switch (Frequency)
            {
                case FrequencyType.Secondly: dt = old.AddSeconds(Interval); break;
                case FrequencyType.Minutely: dt = old.AddMinutes(Interval); break;
                case FrequencyType.Hourly: dt = old.AddHours(Interval); break;
                case FrequencyType.Daily: dt = old.AddDays(Interval); break;
                case FrequencyType.Weekly:
                    // How the week increments depends on the WKST indicated (defaults to Monday)
                    // So, basically, we determine the week of year using the necessary rules,
                    // and we increment the day until the week number matches our "goal" week number.
                    // So, if the current week number is 36, and our Interval is 2, then our goal
                    // week number is 38.
                    // NOTE: fixes RRULE12 eval.
                    int current = _Calendar.GetWeekOfYear(old.Value, System.Globalization.CalendarWeekRule.FirstFourDayWeek, Wkst),
                        lastLastYear = _Calendar.GetWeekOfYear(new DateTime(old.Year-1, 12, 31, 0, 0, 0, DateTimeKind.Local), System.Globalization.CalendarWeekRule.FirstFourDayWeek, Wkst),
                        last = _Calendar.GetWeekOfYear(new DateTime(old.Year, 12, 31, 0, 0, 0, DateTimeKind.Local), System.Globalization.CalendarWeekRule.FirstFourDayWeek, Wkst),
                        goal = current + Interval;

                    // If the goal week is greater than the last week of the year, wrap it!
                    if (goal > last)
                        goal = goal - last;
                    else if (goal <= 0)
                        goal = lastLastYear + goal;

                    int interval = Interval > 0 ? 1 : -1;
                    while (current != goal)
                    {
                        old = old.AddDays(interval);
                        current = _Calendar.GetWeekOfYear(old.Value, System.Globalization.CalendarWeekRule.FirstFourDayWeek, Wkst);
                    }

                    dt = old;
                    break;
                case FrequencyType.Monthly: dt = old.AddDays(-old.Day + 1).AddMonths(Interval); break;
                case FrequencyType.Yearly: dt = old.AddDays(-old.DayOfYear + 1).AddYears(Interval); break;
                default: throw new Exception("FrequencyType.NONE cannot be evaluated. Please specify a FrequencyType before evaluating the recurrence.");
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:41,代码来源:RecurrencePattern.cs

示例5: CreateInitialize

        public override void CreateInitialize()
        {
            base.CreateInitialize();

            // Create a new UID for the component
            UID = UniqueComponent.NewUID();

            // Here, we don't simply set to DateTime.Now because DateTime.Now contains milliseconds, and
            // the iCalendar standard doesn't care at all about milliseconds.  Therefore, when comparing
            // two calendars, one generated, and one loaded from file, they may be functionally identical,
            // but be determined to be different due to millisecond differences.
            DateTime now = DateTime.Now;
            Created = new iCalDateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
            DTStamp = Created.Copy();
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:15,代码来源:UniqueComponent.cs

示例6: EvaluateToPreviousOccurrence

        private void EvaluateToPreviousOccurrence(iCalDateTime completedDate, iCalDateTime currDt)
        {
            iCalDateTime beginningDate = completedDate.Copy();
            if (RRule != null) foreach (RecurrencePattern rrule in RRule) DetermineStartingRecurrence(rrule, ref beginningDate);
            if (RDate != null) foreach (RecurrenceDates rdate in RDate) DetermineStartingRecurrence(rdate, ref beginningDate);
            if (ExRule != null) foreach (RecurrencePattern exrule in ExRule) DetermineStartingRecurrence(exrule, ref beginningDate);
            if (ExDate != null) foreach (RecurrenceDates exdate in ExDate) DetermineStartingRecurrence(exdate, ref beginningDate);

            Evaluate(beginningDate, currDt);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:10,代码来源:Todo.cs


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