示例#1
0
        internal override void Remove(BaseItemWin item)
        {
            if (item is HomeworkWin)
            {
                Homework.Remove(item as HomeworkWin);
            }

            else if (item is ExamWin)
            {
                Exams.Remove(item as ExamWin);
            }

            else if (item is ScheduleWin)
            {
                Schedules.Remove(item as ScheduleWin);
            }

            else if (item is WeightCategoryWin)
            {
                WeightCategories.Remove(item as WeightCategoryWin);
            }

            else
            {
                throw new NotImplementedException("Item to be removed from Class wasn't any of the supported types.");
            }
        }
示例#2
0
        internal override void Add(BaseItemWin item)
        {
            SemesterWin semester = (SemesterWin)item;

            semester.Parent = this;

            Semesters.InsertSorted(semester);
        }
示例#3
0
        public override int CompareTo(BaseItemWin other)
        {
            if (other is ClassWin)
            {
                return(CompareTo(other as ClassWin));
            }

            return(base.CompareTo(other));
        }
示例#4
0
        public override int CompareTo(BaseItemWin other)
        {
            if (other is ExamWin)
            {
                return(CompareTo(other as ExamWin));
            }

            if (other is HomeworkWin)
            {
                return(CompareTo(other as HomeworkWin));
            }

            return(base.CompareTo(other));
        }
示例#5
0
        internal override void Remove(BaseItemWin item)
        {
            if (item is ClassWin)
            {
                Classes.Remove(item as ClassWin);
            }

            else if (item is TaskWin)
            {
                Tasks.Remove(item as TaskWin);
            }

            else
            {
                throw new NotImplementedException("Object being removed from Semester wasn't any of the supported types.");
            }
        }
示例#6
0
        internal override void Add(BaseItemWin item)
        {
            if (item is ClassWin)
            {
                Classes.InsertSorted(item as ClassWin);
            }

            else if (item is TaskWin)
            {
                Tasks.InsertSorted(item as TaskWin);
            }

            else
            {
                throw new NotImplementedException();
            }
        }
示例#7
0
 internal override void Add(BaseItemWin item)
 {
     throw new NotImplementedException();
 }
示例#8
0
        public override int CompareTo(BaseItemWin other)
        {
            if (other is HomeworkWin || other is ExamWin)
            {
                //if on same day, these go earlier than tasks
                if (Date.Date == ((ExamWin)other).Date.Date)
                {
                    return(1);
                }

                //else oldest item goes first
                else
                {
                    return(Date.CompareTo(((ExamWin)other).Date));
                }
            }

            if (other is TaskWin)
            {
                TaskWin task = other as TaskWin;

                //if this is due on an earlier day
                if (Date.Date < task.Date.Date)
                {
                    return(-1);
                }

                //else if this is due on a later day
                if (Date.Date > task.Date.Date)
                {
                    return(1);
                }

                //else they're both on the same day...

                //if this is complete
                if (IsComplete)
                {
                    //if both are complete
                    if (task.IsComplete)
                    {
                        return(Updated.CompareTo(task.Updated));
                    }

                    //other isn't complete, place this later
                    return(1);
                }

                //else this isn't complete

                //if the other is complete, this goes first
                if (task.IsComplete)
                {
                    return(-1);
                }

                //else if this is more recent, put it last
                return(Updated.CompareTo(task.Updated));
            }

            return(base.CompareTo(other));
        }
示例#9
0
 internal override void Remove(BaseItemWin item)
 {
     Semesters.Remove((SemesterWin)item);
 }
示例#10
0
 internal override void Remove(BaseItemWin item)
 {
     Years.Remove((YearWin)item);
 }
示例#11
0
 internal override void Add(BaseItemWin item)
 {
     Years.InsertSorted((YearWin)item);
 }
示例#12
0
 internal override void Remove(BaseItemWin item)
 {
     //teachers aren't supported yet
     throw new NotImplementedException();
 }
 internal override void Remove(BaseItemWin item)
 {
     Grades.Remove(item as GradeWin);
 }
 internal override void Add(BaseItemWin item)
 {
     Grades.InsertSorted((GradeWin)item);
 }