#if FRAMEWORK20 using System; using System.Collections.Generic; using System.Text; using System.Collections.ObjectModel; namespace DevComponents.Schedule.Model { /// /// Represents the calendar year. /// public class Year { #region Internal Implementation private int _Year = 0; private CalendarModel _CalendarModel = null; private ReadOnlyCollection _ReadOnlyMonths = null; private List _Months = null; /// /// Initializes a new instance of the Year class. /// /// /// public Year(int year, CalendarModel calendarModel) { _Year = year; _CalendarModel = calendarModel; } /// /// Returns read-only collection of months in year. /// public ReadOnlyCollection Months { get { if (_ReadOnlyMonths == null) CreateCollection(); return _ReadOnlyMonths; } } private void CreateCollection() { _Months = new List(12); for (int i = 0; i < 12; i++) { _Months.Add(new Month(_CalendarModel, _Year, i + 1)); } _ReadOnlyMonths = new ReadOnlyCollection(_Months); } internal void InvalidateAppointments() { if (_Months == null) return; foreach (Month month in _Months) { month.InvalidateAppointments(); } } internal void InvalidateAppointments(int month, int day) { if (_Months == null) return; _Months[month - 1].InvalidateAppointments(day); } #endregion } } #endif