Пример #1
0
        private void BetButton_Click(object sender, RoutedEventArgs e)
        {
            var item           = DogComboBox.SelectedValue as ComboBoxItem;
            var selecetedIndex = DogComboBox.SelectedIndex;

            if (item != null)
            {
                if (FirstRadiotbn.IsChecked == true)
                {
                    if (Joe.PlaceBet(Int32.Parse(BetTextBox.Text), selecetedIndex))
                    {
                        FirstTextBox.Text = string.Format("Joe bets {0} on {1}", BetTextBox.Text, item.Content);
                    }
                    else
                    {
                        FirstTextBox.Text = string.Format("Joe does't have enough money to place this bet");
                    }
                }
                else if (SecondRadiobtn.IsChecked == true)
                {
                    if (Bob.PlaceBet(Int32.Parse(BetTextBox.Text), selecetedIndex))
                    {
                        SecondTextBox.Text = string.Format("Bob bets {0} on {1}", BetTextBox.Text, item.Content);
                    }
                    else
                    {
                        SecondTextBox.Text = string.Format("Bob does't have enough money to place this bet");
                    }
                }

                else if (ThirdRadionbtn.IsChecked == true)
                {
                    if (Al.PlaceBet(Int32.Parse(BetTextBox.Text), selecetedIndex))
                    {
                        ThirdTextBox.Text = string.Format("Al bets {0} on {1}", BetTextBox.Text, item.Content);
                    }
                    else
                    {
                        FirstTextBox.Text = string.Format("Al does't have enough money to place this bet");
                    }
                }
            }
        }