コード例 #1
0
 private void SortStudentsBtn_Click(object sender, EventArgs e)
 {
     try
     {
         List <Student> students = StudentsDGVConvert.DGVToStudentsList(InputStudentsDGV);
         StudentsDGVConvert.StudentsListToDGV(InputStudentsDGV, StudentsSorter.Sort(students));
     }
     catch (Exception ex)
     {
         MessagesUtils.ShowError("Произошла ошибка!");
     }
 }
コード例 #2
0
        private void MainMenuFileSave_Click(object sender, EventArgs e)
        {
            if (SaveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string path = SaveFileDialog.FileName;

                    List <Student> studentsList = StudentsDGVConvert.DGVToStudentsList(InputStudentsDGV);
                    StudentsFilesUtils.SaveStudentsListInFile(path, studentsList);

                    MessagesUtils.ShowMessage("Данные сохранены в файл");
                }
                catch (Exception ex)
                {
                    MessagesUtils.ShowError("Ошибка сохранения в файл");
                }
            }
        }
コード例 #3
0
        private void MainMenuFileOpen_Click(object sender, EventArgs e)
        {
            if (OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string path = OpenFileDialog.FileName;

                    List <Student> studentsList = StudentsFilesUtils.ReadStudentsListFromFile(path);
                    StudentsDGVConvert.StudentsListToDGV(InputStudentsDGV, studentsList);

                    MessagesUtils.ShowMessage("Данные загружены из файла");
                }
                catch (Exception ex)
                {
                    MessagesUtils.ShowError("Ошибка чтения из файла");
                }
            }
        }