Ejemplo n.º 1
0
        /// <summary>
        /// Reads the playing field and adjusts the buttons accordingly
        /// </summary>
        private void redrawField()
        {
            var board = logic.GetBoard();// Board aus der Logik lesen

            // Alle button durchgehen und entsprechend des Boards mit X, O oder leerem text füllen
            for (int y = 0; y < buttonArray.GetLength(0); y++)
            {
                for (int x = 0; x < buttonArray.GetLength(1); x++)
                {
                    buttonArray[y, x].Content = board[y, x] switch { FieldState.X => "X", FieldState.O => "O", _ => "" };
                    //buttonArray[y, x].IsEnabled = board[y, x] switch { FieldState.X => false, FieldState.O => false, _ => true };
                }
            }
        }