private void UpdateWindow() { int n_flagged = 0; for (int i = 0; i < flagged.GetLength(0); i++) { for (int j = 0; j < flagged.GetLength(1); j++) { if (flagged[i, j] == true) { n_flagged++; } } } NUMBER_MINES.Text = Convert.ToString(game.GetNumberMines() - n_flagged); for (int i = 0; i < game.GetRows(); i++) { for (int j = 0; j < game.GetCols(); j++) { if (game.GetField()[i, j].IsOpen() == false) { if (flagged[i, j] == true) { buttons[i, j].Content = "\uD83C\uDFF3"; //buttons[i, j].Background = System.Windows.Media.Brushes.Green; buttons[i, j].FontWeight = FontWeights.Bold; } else { buttons[i, j].Content = ""; buttons[i, j].Background = System.Windows.Media.Brushes.DarkGray; } } else if (game.GetField()[i, j].IsMine() == true) { buttons[i, j].Content = "\uD83D\uDCA3"; buttons[i, j].FontSize = 20.0; buttons[i, j].Background = System.Windows.Media.Brushes.Red; buttons[i, j].FontWeight = FontWeights.Bold; } else { int nM = game.GetField()[i, j].GetNNeighbouringMines(); buttons[i, j].Content = (nM > 0) ? Convert.ToString(nM) : ""; buttons[i, j].Foreground = colors[nM]; buttons[i, j].Background = System.Windows.Media.Brushes.LightGray; buttons[i, j].FontSize = 20.0; buttons[i, j].FontWeight = FontWeights.Bold; } } } }