/// <summary>
        /// Creates a new <see cref="CalendarTimeScaleUnit"/>
        /// </summary>
        /// <param name="day"><see cref="CalendarDay"/> this unit belongs to</param>
        /// <param name="index">Index of the unit relative to the container day</param>
        /// <param name="hours">Hour of the unit</param>
        /// <param name="minutes">Minutes of the unit</param>
        internal CalendarTimeScaleUnit(CalendarDay day, int index, int hours, int minutes)
            : base(day.Calendar)
        {
            _day     = day;
            _index   = index;
            _hours   = hours;
            _minutes = minutes;

            _passingItems = new List <CalendarItem>();
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new <see cref="CalendarTimeScaleUnit"/>
        /// </summary>
        /// <param name="day"><see cref="CalendarDay"/> this unit belongs to</param>
        /// <param name="index">Index of the unit relative to the container day</param>
        /// <param name="hours">Hour of the unit</param>
        /// <param name="minutes">Minutes of the unit</param>
        internal CalendarTimeScaleUnit(CalendarDay day, int index, int hours, int minutes)
            : base(day.Calendar)
        {
            _day = day;
            _index = index;
            _hours = hours;
            _minutes = minutes;

            _passingItems = new List<CalendarItem>();
        }
Beispiel #3
0
 /// <summary>
 /// Invalidates the bounds of the specified day
 /// </summary>
 /// <param name="day"></param>
 public void Invalidate(CalendarDay day)
 {
     Invalidate(day.Bounds);
 }
 /// <summary>
 /// Creates a new <see cref="CalendarRendererDayEventArgs"/> object
 /// </summary>
 /// <param name="original">Orignal object to copy basic paramters</param>
 /// <param name="day">Day to render</param>
 public CalendarRendererDayEventArgs(CalendarRendererEventArgs original, CalendarDay day)
     : base(original)
 {
     _day = day;
 }
Beispiel #5
0
        /// <summary>
        /// Updates the 
        /// </summary>
        private void UpdateDaysAndWeeks()
        {
            TimeSpan span = (new DateTime(ViewEnd.Year, ViewEnd.Month, ViewEnd.Day, 23, 59, 59)).Subtract(ViewStart.Date);
            int preDays = 0;
            span = span.Add(new TimeSpan(0,0,0,1,0));

            if (span.Days < 1 || span.Days > MaximumViewDays )
            {
                throw new Exception("Days between ViewStart and ViewEnd should be between 1 and MaximumViewDays");
            }

            if (span.Days > MaximumFullDays)
            {
                SetDaysMode(CalendarDaysMode.Short);
                preDays = (new int[] { 0, 1, 2, 3, 4, 5, 6 })[(int)ViewStart.DayOfWeek] - (int)FirstDayOfWeek;
                span = span.Add(new TimeSpan(preDays, 0, 0, 0));

                while (span.Days % 7 != 0)
                    span = span.Add(new TimeSpan(1, 0, 0, 0));
            }
            else
            {
                SetDaysMode(CalendarDaysMode.Expanded);
            }

            _days = new CalendarDay[span.Days];

            for (int i = 0; i < Days.Length; i++)
                Days[i] = new CalendarDay(this, ViewStart.AddDays(-preDays + i), i);

            
            //Weeks
            if (DaysMode == CalendarDaysMode.Short)
            {
                List<CalendarWeek> weeks = new List<CalendarWeek>();

                for (int i = 0; i < Days.Length; i++)
                {
                    if (Days[i].Date.DayOfWeek == FirstDayOfWeek)
                    {
                        weeks.Add(new CalendarWeek(this, Days[i].Date));
                    }
                }

                _weeks = weeks.ToArray();
            }
            else
            {
                _weeks = new CalendarWeek[] { };
            }

            UpdateHighlights();
            
        }
 /// <summary>
 /// Creates a new DayTop for the specified day
 /// </summary>
 /// <param name="day"></param>
 public CalendarDayTop(CalendarDay day)
     : base(day.Calendar)
 {
     _day          = day;
     _passingItems = new List <CalendarItem>();
 }
Beispiel #7
0
 /// <summary>
 /// Creates a new DayTop for the specified day
 /// </summary>
 /// <param name="day"></param>
 public CalendarDayTop(CalendarDay day)
     : base(day.Calendar)
 {
     _day = day;
     _passingItems = new List<CalendarItem>();
 }
 /// <summary>
 /// Creates a new event with the specified day
 /// </summary>
 /// <param name="day">Day of the event</param>
 public CalendarDayEventArgs(CalendarDay day)
 {
     _calendarDay = day;
 }
 /// <summary>
 /// Creates a new event with the specified day
 /// </summary>
 /// <param name="day">Day of the event</param>
 public CalendarDayEventArgs(CalendarDay day)
 {
     _calendarDay = day;
 }
 /// <summary>
 /// Creates a new <see cref="CalendarRendererDayEventArgs"/> object
 /// </summary>
 /// <param name="original">Orignal object to copy basic paramters</param>
 /// <param name="day">Day to render</param>
 public CalendarRendererDayEventArgs(CalendarRendererEventArgs original, CalendarDay day)
     : base(original)
 {
     _day = day;
 }