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 saveToFileToolStripMenuItem_Click(object sender, EventArgs e) { var save = new SaveFileDialog { Filter = "Text file|*.txt", FileName = "matrix.txt" }; if (save.ShowDialog() == DialogResult.OK) { IMatrix A; IVector x0, b; SLAESource.GetSLAE(out A, format, out b, out x0); File.WriteAllText(save.FileName, A.Serialize(b, x0)); } }
public void Update(string type) { SLAESource.GetSLAE(out matrix, type, out b, out x0); int n = matrix.Size; Location = Owner.Location; format = type; DataGridView mat = new DataGridView(); mat = MatrixVisualRepresentation.CoordinationalToGridView(MatrixExtensions.ConvertToCoordinationalMatrix(matrix), SLAESource.IsSymmetric); MatrixVisualRepresentation.CopyDataGridView(mat, ref A); width = cellWidth * (n - 2); heigth = cellHeight * (n - 2); Size size = new Size(Width > 115 + width ? Width : 115 + width, 190 + heigth); MaximumSize = size; MinimumSize = size; Size = size; A.ReadOnly = true; MatrixVisualRepresentation.PaintPattern(ref A, Color.SteelBlue); }