Пример #1
0
        public Calendar(DateTime startWeekDateTime)
        {
            int delta;

            // DayOfWeekStruct specifies Sunday as the first day of the week, this is a hack to use monday as the first day of the week
            if (startWeekDateTime.DayOfWeek == DayOfWeek.Sunday)
            {
                delta = -6;
            }
            else
            {
                delta = DayOfWeek.Monday - startWeekDateTime.DayOfWeek;
            }

            WeekStartDateTime = startWeekDateTime.AddDays(delta);
            CurrentWeek       = new CalendarWeek(WeekStartDateTime);

            var dayStart = new TimeSpan(0, 0, 0);
            var dayEnd   = new TimeSpan(23, 59, 59);

            Hours       = new TimeLine(DateTime.MinValue, dayEnd - dayStart);
            CurrentTime = new TimeLine(DateTime.Today, dayEnd - dayStart);

            Hours.Events = GenerateTimelineHours();

            TrackCurrentTime();
        }
Пример #2
0
 public void LoadPreviousWeek(List <CalendarEntry> calendarEntries)
 {
     WeekStartDateTime = WeekStartDateTime.Subtract(new TimeSpan(7, 0, 0, 0));
     CurrentWeek       = new CalendarWeek(WeekStartDateTime);
     AddEvents(calendarEntries);
 }
Пример #3
0
 public void LoadNextWeek(List <CalendarEntry> calendarEntries)
 {
     WeekStartDateTime = WeekStartDateTime.Add(new TimeSpan(7, 0, 0, 0));
     CurrentWeek       = new CalendarWeek(WeekStartDateTime);
     AddEvents(calendarEntries);
 }
Пример #4
0
 public void LoadCurrentWeek(List <CalendarEntry> calendarEntries)
 {
     CurrentWeek = new CalendarWeek(WeekStartDateTime);
     AddEvents(calendarEntries);
 }