private void btnLoadDefault_Click(object sender, EventArgs e) { if (comboMajor.SelectedIndex >= 0 && comboDefaulSchedules.SelectedIndex >= 0) { if (comboMajor.SelectedItem.ToString() != "" && comboDefaulSchedules.SelectedItem.ToString() != "") { string file = comboMajor.SelectedItem.ToString() + "_" + comboDefaulSchedules.SelectedItem.ToString() + ".gps"; try { Degree loadDegree = XMLSerializer.DeserializeXMLToDegree(file); loadDegree.TakenCourses = coursesTaken; GenerateSchedulesForm form = new GenerateSchedulesForm("EE", loadDegree, db); form.Show(); } catch { try { Degree loadDegree = XMLSerializer.DeserializeXMLToDegree("..\\..\\" + file); loadDegree.TakenCourses = coursesTaken; GenerateSchedulesForm form = new GenerateSchedulesForm("EE", loadDegree, db); form.Show(); } catch { MessageBox.Show("Error loading template. Please either load another template, or attempt another method of creating a degree plan."); } } } } }
/// <summary> /// load from a file. Creates teh file dialog. /// </summary> private void LoadDegreeFromFile() { System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); openFileDialog1.Filter = "GPS files (*.gps)|*.gps"; DialogResult result = openFileDialog1.ShowDialog(); //nk if (result == DialogResult.OK) //nk { Degree loadDegree = XMLSerializer.DeserializeXMLToDegree(openFileDialog1.FileName); GenerateSchedulesForm form = new GenerateSchedulesForm("EE", loadDegree, db); form.Show(); } }
//Go to Generate Schedule Form private void button1_Click(object sender, EventArgs e) { GenerateSchedulesForm form = new GenerateSchedulesForm(coursesTaken, "EE"); form.Show(); }
//Go to Generate Schedule Form private void button1_Click(object sender, EventArgs e) { ToolTip gen = new ToolTip(); //nk gen.SetToolTip(button1, "Click to Generate Schedules"); //nk this.Controls.Add(button1); //nk Degree temp; if (comboMajor.SelectedIndex >= 0) { string degreeName = db.GetDegreeFromCode(comboMajor.SelectedItem.ToString()); Degree degree = Degree.LoadDegree(db, degreeName); degree.MaxSemesters = comboPosYear.SelectedIndex + 2; degree = Degree.AutoFillSemesters(degree); GenerateSchedulesForm form = new GenerateSchedulesForm(degreeName, degree, db); form.Show(); } #region Deprecated //return; //if (comboMajor.SelectedIndex == 0) //{ // temp = Degree.LoadEE(db); // temp.TakenCourses = coursesTaken; // if (comboPosYear.SelectedIndex >= 0) // { // temp.MaxSemesters = comboPosYear.SelectedIndex + 2; // } // temp = Degree.AutoFillSemesters(temp); // GenerateSchedulesForm form = new GenerateSchedulesForm("CPE", temp, db); // form.Show(); //} //if (comboMajor.SelectedIndex == 1) //{ // temp = Degree.LoadCPE(db); // temp.TakenCourses = coursesTaken; // if (comboPosYear.SelectedIndex >= 0) // { // temp.MaxSemesters = comboPosYear.SelectedIndex + 2; // } // temp = Degree.AutoFillSemesters(temp); // GenerateSchedulesForm form = new GenerateSchedulesForm("CPE", temp, db); // form.Show(); //} //if (comboMajor.SelectedIndex == 2) //{ // temp = Degree.LoadOPE(db); // temp.TakenCourses = coursesTaken; // if (comboPosYear.SelectedIndex >= 0) // { // temp.MaxSemesters = comboPosYear.SelectedIndex + 2; // } // temp = Degree.AutoFillSemesters(temp); // GenerateSchedulesForm form = new GenerateSchedulesForm("OPE", temp, db); // form.Show(); //} #endregion //LoadDegreeFromFile(); //GenerateSchedulesForm form = new GenerateSchedulesForm(coursesTaken, "EE", mDegreeList[comboMajor.SelectedIndex]); //form.Show(); }