コード例 #1
0
        private void btnDrawOnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                //Lotto.moi = 27;
                string selectedGame = cmbGames.Text.ToString();
                int    draws        = int.Parse(txtDraws.Text);
                Lotto  game         = new Lotto(selectedGame, draws);
                //MessageBox.Show(selectedGame + " " + draws.ToString());

                for (int i = 0; i < draws; i++)
                {
                    txtResults.Text += i + ": " + game.numbers[i] + "\n";
                }
                MessageBox.Show("Pelattu: " + Lotto.howMany().ToString() + " kertaa");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "onclick");
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: reapercage/Labra10
 private void btnDraw_Click(object sender, RoutedEventArgs e)
 {
     europot = false;
     if (emptyItem.IsSelected)
     {
     }
     else
     {
         //arvot pelin mukaan
         if (lottoItem.IsSelected)
         {
             lotTruth       = new bool[40];
             lotteryNumbers = 40;
             rownumbers     = 7;
         }
         else if (vikingItem.IsSelected)
         {
             lotTruth       = new bool[49];
             lotteryNumbers = 49;
             rownumbers     = 6;
         }
         else if (euroItem.IsSelected)
         {
             lotTruth       = new bool[51];
             lotteryNumbers = 51;
             rownumbers     = 7;
             europot        = true;
         }
         //arvotaan numerot
         if (txtDraws.Text != "")
         {
             draws = System.Convert.ToInt32(txtDraws.Text);
             //kaatuu jos null tai jtn
             Lotto lottery = new Lotto();
             txbRows.Text = lottery.Game(lotteryNumbers, rownumbers, draws, europot);
         }
         //else if() sisältää muuta kuin kokonaisluvun
     }
 }