public BlackJack() { InitializeComponent(); random = new Random(); player = new Player(random); dealer = new Dealer(random); numUpBet.Text = String.Format("{0}", 0); numUpBet.Maximum = player.BankRoll; totalCash.Text = player.BankRoll.ToString(); deck = new List <Card>(); newDeck = new CreateDeck(deck); UpdateLists(deck, listBox1); }
private void buttonNewHand_Click(object sender, RoutedEventArgs e) { playerCardsPanel.Children.Clear(); player.Cards.Clear(); deck.Clear(); player.ResetTotal(); newDeck = new CreateDeck(deck); dealerCardsPanel.Children.Clear(); dealer.Cards.Clear(); labelStatus.Text = "PLACE BET"; buttonPanel.Children.Remove(buttonNewHand); buttonPanel.Children.Add(buttonDeal); buttonPanel.Children.Add(buttonHit); buttonPanel.Children.Add(buttonStay); buttonDeal.IsEnabled = true; buttonHit.IsEnabled = false; buttonStay.IsEnabled = false; if (player.BankRoll != 0) { numUpBet.IsEnabled = true; numUpBet.Value = player.PlayerBet; } else { labelStatus.Text = "You are broke!"; } if (player.BankRoll <= player.PlayerBet) { numUpBet.IsEnabled = true; numUpBet.Value = player.BankRoll; } numUpBet.Maximum = player.BankRoll; totalCash.Text = (player.BankRoll - player.PlayerBet).ToString(); }