Example #1
0
            public EventItem(DayScheduleItemsArranger arranger, BaseViewItemHomeworkExam item) : base(arranger)
            {
                Item = item;

                StartTime = item.GetDueDateWithTime().TimeOfDay;
                DateTime endTime;

                if (item.TryGetEndDateWithTime(out endTime))
                {
                    EndTime = endTime.TimeOfDay;
                }

                if (EndTime - arranger.MinDuration < StartTime)
                {
                    EndTime = StartTime + arranger.MinDuration;

                    // If that pushes it past 24 hours
                    if (EndTime >= new TimeSpan(24, 0, 0))
                    {
                        // Move the start time up to accomodate the min duration
                        EndTime   = new TimeSpan(23, 59, 0);
                        StartTime = EndTime - arranger.MinDuration;
                    }
                }
            }
Example #2
0
            public ScheduleItem(DayScheduleItemsArranger arranger, ViewItemSchedule viewItem) : base(arranger)
            {
                Item = viewItem;

                StartTime = viewItem.StartTime.TimeOfDay;
                EndTime   = viewItem.EndTime.TimeOfDay;
            }
Example #3
0
        public static DayScheduleItemsArranger Create(AccountDataItem account, SemesterItemsViewGroup semesterItems, ScheduleViewItemsGroup scheduleGroup, DateTime date, double heightOfHour, double spacingWhenNoAdditionalItems, double spacingWithAdditionalItems, double widthOfCollapsed, bool includeHomeworkAndHolidays)
        {
            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            if (semesterItems == null)
            {
                throw new ArgumentNullException(nameof(semesterItems));
            }

            if (scheduleGroup == null)
            {
                throw new ArgumentNullException(nameof(scheduleGroup));
            }

            date = date.Date;

            foreach (var cachedAnswer in _cached)
            {
                if (cachedAnswer.Date == date.Date &&
                    cachedAnswer._semesterItems == semesterItems &&
                    cachedAnswer.HeightOfHour == heightOfHour &&
                    cachedAnswer._spacingWhenNoAdditionalItems == spacingWhenNoAdditionalItems &&
                    cachedAnswer._spacingWithAdditionalItems == spacingWithAdditionalItems &&
                    cachedAnswer._widthOfCollapsed == widthOfCollapsed &&
                    object.Equals(account.SchoolTimeZone, cachedAnswer._schoolTimeZone))
                {
                    return(cachedAnswer);
                }
            }

            DayScheduleItemsArranger answer = new DayScheduleItemsArranger(account, semesterItems, scheduleGroup, date, heightOfHour, spacingWhenNoAdditionalItems, spacingWithAdditionalItems, widthOfCollapsed, includeHomeworkAndHolidays);

            _cached.Add(answer);
            return(answer);
        }
Example #4
0
 public BaseScheduleItem(DayScheduleItemsArranger arranger)
 {
     Arranger = arranger;
 }