private void Next_Click(object sender, EventArgs e) { Next.Enabled = false; Previous.Enabled = false; Save.Enabled = false; TimeTablePanel.Hide(); TimeTablePanel.Controls.Clear(); InitializeHeaderComponents(); try { DisplayTimetableComponents(CoursePlanningController.IndexRefListCollection[++currentIndex]); } // if there is really no next one, generate it catch (ArgumentOutOfRangeException ex) { // oldCollectionPointer is used to determine whether new solution has been generated // therefore it will determine whether the end has been reached int oldCollectionPointer = CoursePlanningController.CollectionPointer; CoursePlanningController cpc = new CoursePlanningController(); cpc.PlanCourseAndDisplayTimetable(); currentIndex = CoursePlanningController.CollectionPointer; if (oldCollectionPointer == currentIndex) MessageBox.Show("There is no more combination."); DisplayTimetableComponents(CoursePlanningController.IndexRefListCollection[currentIndex]); } TimeTablePanel.Show(); Next.Enabled = true; Previous.Enabled = true; Save.Enabled = true; }
private void PlanCourse_Click(object sender, EventArgs e) { CoursePlanningController cpc = new CoursePlanningController(); TimeTablePage ttp = new TimeTablePage(); if (cpc.CheckExamTime()) if (cpc.PlanCourseAndDisplayTimetable()) { ttp.InitializeTable(); ttp.Show(); } }