private void Open_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Title = "Выберите из какого файла загрузить данные"; if (fileDialog.ShowDialog() == DialogResult.OK) { trainList.ReadFromFile(fileDialog.FileName); } TrainSortAndFind trainSort = new TrainSortAndFind("Ost", trainList); trainList = trainSort.Sort(); update(); }
private void Add_Click(object sender, EventArgs e) { try { trainList.Add(textBox1.Text, Convert.ToInt32(textBox2.Text), TimeSpan.Parse(textBox3.Text)); TrainSortAndFind trainSort = new TrainSortAndFind("Ost", trainList); trainList = trainSort.Sort(); update(); } catch (Exception) { MessageBox.Show("Неверные данные", "Error", MessageBoxButtons.OK); } }
private void Sort_Click(object sender, EventArgs e) { string val; if (radioButton1.Checked) { val = "Ost"; } else if (radioButton2.Checked) { val = "Number"; } else { val = "Time"; } TrainSortAndFind trainSort = new TrainSortAndFind(val, trainList); trainList = trainSort.Sort(); update(); }