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"); } }
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 } }