本文整理汇总了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;
}
}