private void forwardItem_Click(object sender, EventArgs e) { if (FormatFactory.PatternRequired(FormatFactory.FormatsDictionary[formatBox.Text])) { if (patternForm == null || patternForm.IsDisposed) { patternForm = new PatternForm(); } patternForm.Owner = this; patternForm.Show(); patternForm.Update(formatBox.Text); Hide(); } else { IMatrix A; IVector x0, b; constructorForm = (ConstructorForm)Owner; constructorForm.GetSLAE(out A, formatBox.Text, out b, out x0); mainForm.SetSLAE(A, b, x0); mainForm.Show(); Hide(); } }
private void fileInput_Click(object sender, EventArgs e) { try { var file = new OpenFileDialog(); file.Filter = "Text file|*.txt"; if (file.ShowDialog() == DialogResult.OK) { StreamReader sr = new StreamReader(file.FileName); string dataInput = sr.ReadToEnd(); sr.Close(); Input = MatrixInitialazer.Input(dataInput, Input, sim.Checked); epsBox.Enabled = true; iterBox.Enabled = true; var tmp = new FormatFactory(); var value = tmp.formats[formatBox.SelectedItem.ToString()]; fileInputedSLAE.matrix = FormatFactory.Init(value, Input, Input.symmetry); var a = FormatFactory.PatternRequired(formatBox.SelectedItem.ToString()); fileInputBtn.Text = file.FileName; fileInputNotNull = true; CheckedChanged(inputCheckedImg, inputChecked = true); } } catch (Exception) { MessageBox.Show("Неправильный формат входного файла.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void formatBox_SelectedIndexChanged(object sender, EventArgs e) { forwardToolStripMenuItem.Enabled = formatBox.SelectedIndex > -1; saveToFileToolStripMenuItem.Enabled = !FormatFactory.PatternRequired(FormatFactory.FormatsDictionary[formatBox.Text]); }