示例#1
0
 private void Save()
 {
     try
     {
         IOFile.WriteFile(Converter.CoursesToStrings(courses));
         MessageBox.Show("Data has been saved", "Save");
     }
     catch (CourseException ce)
     {
         MessageBox.Show(ce.Message, "Error");
     }
 }
示例#2
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         IOFile.NewFile();
         StartSetting();
         courses = new List <Course>();
         ShowEditCourses();
     }
     catch (CourseException ce)
     {
         MessageBox.Show(ce.Message, "Error");
     }
 }
示例#3
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                IOFile.OpenFile();

                courses = Converter.StringsToCourses(IOFile.ReadFile());
                foreach (Course course in courses)
                {
                    Debug.WriteLine(course);
                }
                saveToolStripMenuItem.Enabled = true;
                AddItemToCombo();
                ShowEditCourses();
            }
            catch (CourseException ce)
            {
                MessageBox.Show(ce.Message, "Error");
            }
        }