コード例 #1
0
ファイル: TimeTablePage.cs プロジェクト: ntulsy/StarsHelper
 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;
 }
コード例 #2
0
ファイル: MainPage.cs プロジェクト: ntulsy/StarsHelper
 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();
         }
 }