private void Do_Clear_Click(object sender, EventArgs e) { for (var i = 0; i < textBoxes.Length; ++i) { textBoxes[i].Text = ""; } Debug.Text = ""; if (state != States.before) { Extramethods.changeScene(textBoxes, roBoxes, Coefficient, Operation, true); var j = FMatrix.Columns.Count - 1; for (; j >= 0; --j) { FMatrix.Columns.Remove(FMatrix.Columns[j]); } var k = SMatrix.Columns.Count - 1; for (; k >= 0; --k) { SMatrix.Columns.Remove(SMatrix.Columns[k]); } var l = RMatrix.Columns.Count - 1; for (; l >= 0; --l) { RMatrix.Columns.Remove(RMatrix.Columns[l]); } } Coefficient.Text = ""; state = States.before; }
private void Button1_Click(object sender, EventArgs e) /* START */ { if (state == States.before) { if (Operation.SelectedIndex == 0) { var error = ""; var willContinue = Extramethods.findingErrors(out error, textBoxes); if (MFirstCols.Text != "" && MSecStrs.Text != "" && int.Parse(MFirstCols.Text) != int.Parse(MSecStrs.Text)) { error = "Count of cols first matrix != count of rows second matrix"; willContinue = false; } if (willContinue == false) { Debug.Text = error; } else { matrix1 = new Matrix(int.Parse(MFirstStrs.Text), int.Parse(MFirstCols.Text)); matrix2 = new Matrix(int.Parse(MSecStrs.Text), int.Parse(MSecCols.Text)); matrix3 = new Matrix(matrix1.Rows, matrix2.Cols); Extramethods.changeScene(textBoxes, roBoxes, Coefficient, Operation, false); DataTable table1; DataTable table2; DataTable table3; Extramethods.addCols(out table1, out table2, out table3, matrix1.Cols, matrix1.Rows, matrix2.Cols, matrix2.Rows, matrix3.Cols, matrix3.Rows); FMatrix.DataSource = table1; SMatrix.DataSource = table2; RMatrix.DataSource = table3; state = States.input; } } else if (Operation.SelectedIndex == 1) // addition { var error = ""; var willContinue = Extramethods.findingErrors(out error, textBoxes); if (willContinue == false) { Debug.Text = error; return; } if (int.Parse(MFirstCols.Text) != int.Parse(MSecCols.Text) || int.Parse(MFirstStrs.Text) != int.Parse(MSecStrs.Text)) { Debug.Text = "Count of cols and rows in matrixes are different"; return; } var cols = int.Parse(MFirstCols.Text); var rows = int.Parse(MFirstStrs.Text); matrix1 = new Matrix(rows, cols); matrix2 = new Matrix(rows, cols); matrix3 = new Matrix(rows, cols); Extramethods.changeScene(textBoxes, roBoxes, Coefficient, Operation, false); DataTable table1; DataTable table2; DataTable table3; Extramethods.addCols(out table1, out table2, out table3, cols, rows); FMatrix.DataSource = table1; SMatrix.DataSource = table2; RMatrix.DataSource = table3; state = States.input; } else if (Operation.SelectedIndex == 2) // subtraction { var error = ""; var willContinue = Extramethods.findingErrors(out error, textBoxes); if (willContinue == false) { Debug.Text = error; return; } if (int.Parse(MFirstCols.Text) != int.Parse(MSecCols.Text) || int.Parse(MFirstStrs.Text) != int.Parse(MSecStrs.Text)) { Debug.Text = "Count of cols and rows in matrixes are different"; return; } var cols = int.Parse(MFirstCols.Text); var rows = int.Parse(MFirstStrs.Text); matrix1 = new Matrix(rows, cols); matrix2 = new Matrix(rows, cols); matrix3 = new Matrix(rows, cols); Extramethods.changeScene(textBoxes, roBoxes, Coefficient, Operation, false); DataTable table1; DataTable table2; DataTable table3; Extramethods.addCols(out table1, out table2, out table3, cols, rows); FMatrix.DataSource = table1; SMatrix.DataSource = table2; RMatrix.DataSource = table3; state = States.input; } else if (Operation.SelectedIndex == -1) { Debug.Text = "Choose operator for resolving"; } else { Debug.Text = "Lol what"; } } else { Debug.Text = "You just started calculation matrixes"; } }
private void CopyT_Click(object sender, EventArgs e) { Extramethods.copyMatrix(Debug, FMatrix, SMatrix, RMatrix, 3, matrix1.Rows, matrix1.Cols, matrix2.Rows, matrix2.Cols, matrix3.Rows, matrix3.Cols); }
private void SetS_Click(object sender, EventArgs e) { Extramethods.setMatrix(Debug, FMatrix, SMatrix, RMatrix, 2, matrix1.Rows, matrix1.Cols, matrix2.Rows, matrix2.Cols, matrix3.Rows, matrix3.Cols); }