コード例 #1
0
        //
        private void lToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter           = "txt files (*.gps)|*gps|All files (*.*)|*.*";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Degree degree = XMLSerializer.DeserializeXMLToDegree(openFileDialog1.FileName);

                mCoursesTaken = degree.TakenCourses;
                mDegree       = degree;
                uiClassList.SetTakenClass(mCoursesTaken);
                // RegisterClicks();
                //add the degree control to the tab

                while (mDegree.Semesters.Count < mDegree.MaxSemesters)
                {
                    mDegree.Semesters.Add(new Semester());
                }

                DegreeControl page = new DegreeControl(mDegree, mCoursesTaken, this, "Default");
                mTabs.Items.Clear();
                mTabs.Items.Add(page);

                //this.RegCourses(degree);
            }
        }
コード例 #2
0
        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.");
                        }
                    }
                }
            }
        }
コード例 #3
0
        /// <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();
            }
        }
コード例 #4
0
        //save the degree out
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog openFileDialog1 = new SaveFileDialog();

            openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter           = "txt files (*.gps)|GPS";
            openFileDialog1.AddExtension     = true;
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.CheckFileExists  = false;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Degree degree = mDegree.Clone();
                degree.Semesters.Clear();
                DegreeControl control = (DegreeControl)mTabs.Items[mTabs.SelectedIndex];
                degree.Semesters    = control.Semesters;
                degree.TakenCourses = uiClassList.GetTakenList();


                XMLSerializer.SerializeDegreeToXML(degree, openFileDialog1.FileName + ".gps");
            }
        }