Ejemplo n.º 1
0
        /// <summary>
        /// Method that handles when user taps a square on the gameboard.
        /// Square is first operated in GameBoard class. After that visual
        /// presentation is updated for the user to see.
        /// </summary>
        /// <param name="button">ImageButtonWithName that presents the icon on gameboard.</param>
        internal static void SquareClicked(ImageButtonWithName button)
        {
            // Operating square in gameboard class.
            var newIcon = _gameBoard.OperateSquare(button.ImageName, AlternativeIcons);

            // Changing the appearance of the icon accordingly.
            if (newIcon == "")
            {
                button.Source = null;
                var square = (GameBoardSquare)button.Parent;
                square.IsEmpty = true;
            }
            else
            {
                button.Source = newIcon;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method that is launched when icon on gameboard is tapped.
        /// Notice that this method is not activated, when user taps an empty square!
        /// </summary>
        /// <param name="sender">ImageButtonWithName object (icon on gameboard) that is being pressed.</param>
        /// <param name="args">Event args, not used.</param>
        public void ButtonClick(object sender, EventArgs args)
        {
            ImageButtonWithName button = (ImageButtonWithName)sender;

            SquareClicked(button);
        }