Esempio n. 1
0
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            switch ((string)lbxGames.SelectedItem)
            {
            case "Poker":
                PokerSettings pokerSettings = (PokerSettings)settings;
                List <string> pokerNames    = new List <string>();
                PokerLogic    poker         = new PokerLogic(pokerSettings.cbxWithHouse.IsChecked);

                for (int i = 0; i < (int)pokerSettings.cmbxPlayerCount.SelectedItem; i++)
                {
                    var nameHolder = (StackPanel)pokerSettings.ugridPlayerNames.Children[i];
                    var name       = (TextBox)nameHolder.Children[1];
                    poker.Players.Add(new Player()
                    {
                        Name        = name.Text,
                        Bank        = 100,
                        CardsInHand = new List <Card>()
                    });
                }
                PokerView = new PokerView.PokerWin(poker);

                PokerView.Show();
                Close();
                break;

            case "Blackjack":
                BlackjackSettings blackjackSettings = (BlackjackSettings)settings;
                List <string>     blackjackNames    = new List <string>();
                for (int i = 0; i < (int)blackjackSettings.cmbxPlayerCount.SelectedItem; i++)
                {
                    var nameHolder = (StackPanel)blackjackSettings.ugridPlayerNames.Children[i];
                    var name       = (TextBox)nameHolder.Children[1];
                    blackjackNames.Add(name.Text);
                }
                BlackJackView.MainWindow blackjackWindow = new BlackJackView.MainWindow(blackjackNames, true);
                blackjackWindow.Show();
                Close();
                break;
            }
        }
    public PokerWinControl()
    {
        pokerWin = new PokerWin();

        pokerWin.AddExitEvent(Exit);
    }