public void Update(PlayerCardsInfo playerCardsInfo)
 {
     if (playerCardsInfo.GameID == gameID && playerCardsInfo.PlayerID == playerID)
     {
         this.Dispatcher.Invoke(() =>
         {
             hole1.Source = GUICards.GetImageSource(playerCardsInfo.PlayerCards[0]);
             hole2.Source = GUICards.GetImageSource(playerCardsInfo.PlayerCards[1]);
         });
     }
 }
        private void UpdateCommunityCards(int roundNumber, CardType[] cards)
        {
            switch (roundNumber)
            {
            case 2:
                com1.Source = GUICards.GetImageSource(cards[0]);
                com2.Source = GUICards.GetImageSource(cards[1]);
                com3.Source = GUICards.GetImageSource(cards[2]);
                break;

            case 3:
                com4.Source = GUICards.GetImageSource(cards[3]);
                break;

            case 4:
                com5.Source = GUICards.GetImageSource(cards[4]);
                break;
            }
        }
Beispiel #3
0
        private void UpdateEndGameWindow(EndGameInfo endGameInfo)
        {
            if (endGameInfo.IsSplitPot)
            {
                LblWinner.Content        = "Split Pot";
                LblWinnerName.Visibility = Visibility.Hidden;
            }
            string usernameWinner = endGameInfo.UsernameWinner;

            LblWinnerName.Content = usernameWinner;
            if (!endGameInfo.OnePlayerLeft)
            {
                List <PlayerCardsInfo> playersCards = endGameInfo.PlayersCards;
                int i = 0;
                foreach (PlayerCardsInfo playerCards in playersCards)
                {
                    if (!playerCards.Username.Equals(usernameWinner))
                    {
                        images[2 * i].Source     = GUICards.GetImageSource(playerCards.PlayerCards[0]);
                        images[2 * i + 1].Source = GUICards.GetImageSource(playerCards.PlayerCards[1]);
                        labels[i].Content        = playerCards.Username;
                        i++;
                    }
                    else
                    {
                        ImgWinner1.Source          = GUICards.GetImageSource(playerCards.PlayerCards[0]);
                        ImgWinner2.Source          = GUICards.GetImageSource(playerCards.PlayerCards[1]);
                        LblWinnerCandidate.Content = usernameWinner;
                    }
                }

                for (int j = i; j < 8; j++)
                {
                    images[2 * j].Visibility     = Visibility.Hidden;
                    images[2 * j + 1].Visibility = Visibility.Hidden;
                    labels[j].Visibility         = Visibility.Hidden;
                }

                ImgCom1.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[0]);
                ImgCom2.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[1]);
                ImgCom3.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[2]);
                ImgCom4.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[3]);
                ImgCom5.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[4]);
            }
            else
            {
                for (int i = 0; i < 8; i++)
                {
                    images[2 * i].Visibility     = Visibility.Hidden;
                    images[2 * i + 1].Visibility = Visibility.Hidden;
                    labels[i].Visibility         = Visibility.Hidden;
                }

                ImgCom1.Visibility            = Visibility.Hidden;
                ImgCom2.Visibility            = Visibility.Hidden;
                ImgCom3.Visibility            = Visibility.Hidden;
                ImgCom4.Visibility            = Visibility.Hidden;
                ImgCom5.Visibility            = Visibility.Hidden;
                ImgWinner1.Visibility         = Visibility.Hidden;
                ImgWinner2.Visibility         = Visibility.Hidden;
                LblWinnerCandidate.Visibility = Visibility.Hidden;
            }
        }