public void FillHijriMonths(TimeInterval visibleInterval) { DateTime start = visibleInterval.Start; DateTime visibleEnd = visibleInterval.End; TimeInterval currentMonthInterval = CreateCurrentMonthInterval(start); HijriMonths.BeginUpdate(); try { HijriMonths.Clear(); HijriMonths.Add(currentMonthInterval); start = currentMonthInterval.End; for (;;) { if (start >= visibleEnd) { break; } DateTime end = HijriCalendar.AddMonths(start, 1); if (end > visibleEnd) { end = visibleEnd; } TimeInterval interval = new TimeInterval(start, end); HijriMonths.Add(interval); start = interval.End; } } finally { HijriMonths.EndUpdate(); } }
public bool IsOddHijriMonths(TimeInterval timeInterval) { Predicate <TimeInterval> intervalMatch = delegate(TimeInterval interval) { return(interval.IntersectsWith(timeInterval)); }; TimeInterval monthInterval = HijriMonths.Find(intervalMatch); if (monthInterval == null) { return(false); } if (HijriMonths.IndexOf(monthInterval) % 2 != 0) { return(true); } return(false); }