private void button_Refresh_Click(object sender, EventArgs e) { _matrixGame = null; _table = null; dataGridView_InputData_Methods.RowCount = Convert.ToInt32(numericUpDown_InputData_Rows.Value); dataGridView_InputData_Methods.ColumnCount = Convert.ToInt32(numericUpDown_InputData_Collumns.Value); button_Calculate.Enabled = true; }
private void WriteMatrixGame(MatrixGame matrixGame) { dataGridView_InputData_Methods.RowCount = matrixGame.Array.Count; dataGridView_InputData_Methods.ColumnCount = matrixGame.Array.First().Count; for (int i = 0; i < dataGridView_InputData_Methods.RowCount; i++) { for (int j = 0; j < dataGridView_InputData_Methods.ColumnCount; j++) { dataGridView_InputData_Methods.Rows[i].Cells[j].Value = matrixGame.Array[i][j]; } } }
// algorithm private void button_Calculate_Click(object sender, EventArgs e) { try { if (_matrixGame == null) { _matrixGame = ReadMatrixGame(); } if (_matrixGame.MakeStep()) { button_Calculate.Enabled = false; button_Next.Enabled = true; } WriteMatrixGame(_matrixGame); } catch (Exception exception) { ShowResult(); } }