private void openMenu_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Текстовые файлы (*.txt)|*.txt|Все файлы (*.*)|*.*"; if (dialog.ShowDialog() == DialogResult.OK) { FilePath = dialog.FileName; OpenFile?.Invoke(this, EventArgs.Empty); approximation = new Approximation(ConvertToPoints(), a, b); } }
private void coefficientsMenu_Click(object sender, EventArgs e) { if (FilePath == null) { DialogResult result = MessageBox.Show("Вы не выбрали файл, содержащий входные данные. Задать их по умолнчанию?", "Ошибка", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { approximation = new Approximation(new double[, ] { { 1, 1 }, { 2, 4 }, { 3, 9 }, { 4, 16 }, { 5, 25 } }, a, b); } else { return; } } MessageBox.Show($"Коэффициенты a = {approximation.A},\n b = {approximation.B}" + $",\n c = {approximation.C}"); }