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


C# IRecurrencePattern.ToString方法代码示例

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


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

示例1: GetRecurringEvents

		public IEnumerable<SEvent> GetRecurringEvents(IEvent evnt, IRecurrencePattern recur)
		{
			if (evnt == null || recur == null || evnt.UID.IsNullOrEmpty())
				yield break;
			SEvent rEvent = ToEvent(evnt, true);
			if (rEvent == null)
				yield break;

			rEvent.RRuleStr = recur.ToString();
			if (rEvent.RRuleStr.IsNullOrEmpty())
				yield break;

			DateTime maxDT = _now.AddMonths(3);

			IList<Occurrence> occurrences = evnt.GetOccurrences(EarliestIncludeEventTime, maxDT);

			if (occurrences == null)
				yield break;

			//if (occurrences.Count < 2) {
			//	occurrences = evnt.GetOccurrences(EarliestIncludeEventTime, maxDT);
			//	if (occurrences == null || occurrences.Count == 0)
			//		yield break;
			//}
			if (occurrences.IsNullOrEmpty())
				yield break;

			if (occurrences.Count > 9)
				occurrences = occurrences.Take(9).ToList();

			DateTime updated = evnt.LastModified.ToDateTime(evnt.Start.ToDateTime(_now));

			for (int i = 0; i < occurrences.Count; i++) {
	
				IPeriod period = occurrences[i].Period;
				if (period == null || period.StartTime == null)
					continue;
				if (period.EndTime == null)
					period.EndTime = period.StartTime;

				bool hasTime;
				DateTimeOffset start = GetLocalTime(period.StartTime, _currentTZ, out hasTime);
				
				string idAppend = i < 1 ? null : "_recur-" + i + "-" + start.Date.XmlTime();
				var ev = rEvent.Copy(idAppend);

				ev.Start = start;
				ev.End = GetLocalTime(period.EndTime, _currentTZ, out hasTime);
				ev.Updated = SetUpdatedEventTimeToStartTime ? ev.Start.DateTime : updated;
				ev.IsAllDay = ev.Start.TimeOfDay == con_EmptyTime && ev.End.TimeOfDay == con_EmptyTime;

				yield return ev;
			}
		}
开发者ID:TopperDEL,项目名称:DDay.iCal,代码行数:54,代码来源:SimpleICal.cs


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