Пример #1
0
        /// <summary>
        /// Method for handling the event of all money loss.
        /// </summary>
        private void NoMoney()
        {
            int moneyMoreThanZero = person.wallet.GetCredit();

            if (moneyMoreThanZero <= 0)
            {
                MessageBoxResult result = MessageBox.Show("You got no money left, huh? Do you want to exit," +
                                                          " kick the machine and go kill yourself? Or at least re-think your life you f*****g gambling addict!"
                                                          , "NO MONEY left! Wife is gonna KILL YOU!", MessageBoxButton.YesNo, MessageBoxImage.Warning);

                if (MessageBoxResult.Yes == result)
                {
                    Close();
                }
                else if (MessageBoxResult.No == result)
                {
                    int inputCredit = 0;
                    person.wallet.SetCredit(inputCredit);
                    BetTextBox.Clear();
                    CreditTextBox.Clear();
                    CreditLabel.Content = " ";
                    NameLabel.Content   = " ";
                }
            }
        }
Пример #2
0
        private void BetButton_Click(object sender, EventArgs e)
        {
            var result = int.TryParse(BetTextBox.Text, out int bet);

            BetTextBox.Clear();
            if (player.Money < bet || !result || game.banker.Money < bet || bet < 0)
            {
                MessageBox.Show("неккоректный ввод");
            }
            else
            {
                BetLabel.Text = bet.ToString();
                game.CurrentRound.CurrentBatch.Bet = bet;
                HitButton.Enabled   = true;
                StandButton.Enabled = true;
                BetButton.Enabled   = false;
            }
        }