private void ShowResult(Matrix result, frmGame visualizer, bool showAnimation) { foreach (Control pnlQuadrant in visualizer.Controls) { if (pnlQuadrant.GetType() == typeof(Panel)) { if (pnlQuadrant.Name != "pnlControls" && pnlQuadrant.Name != "pnlResults") { foreach (TextBox txtCell in pnlQuadrant.Controls) { string[] strCoords = txtCell.Tag.ToString().Split(';'); Point coordinates = new Point(Convert.ToInt32(strCoords[0]), Convert.ToInt32(strCoords[1])); if (result.Rows[coordinates.X - 1].Cells[coordinates.Y - 1].Value > 0) { if (txtCell.Text != result.Rows[coordinates.X - 1].Cells[coordinates.Y - 1].Value.ToString()) { if (showAnimation) { txtCell.ForeColor = Color.Blue; txtCell.Font = new Font(txtCell.Font, FontStyle.Bold); } txtCell.Text = result.Rows[coordinates.X - 1].Cells[coordinates.Y - 1].Value.ToString(); if (showAnimation) { Application.DoEvents(); Thread.Sleep(_animationSeconds); } } } else { if (!string.IsNullOrEmpty(txtCell.Text)) { if (showAnimation) { txtCell.ForeColor = Color.Red; txtCell.Font = new Font(txtCell.Font, FontStyle.Bold); Application.DoEvents(); Thread.Sleep(_animationSeconds); } txtCell.Text = string.Empty; } } } } } } }
private void ShowResults(List<Matrix> results) { foreach (Matrix result in results) { try { frmGame visualizer = new frmGame(); visualizer.pnlControls.Visible = false; visualizer.pnlResults.Visible = false; visualizer.Width = 491; visualizer.btnFechar.Visible = true; Results.Add(visualizer); ShowResult(result, visualizer, false); visualizer.Show(); } catch { } } }