private void btnDraw_Click(object sender, RoutedEventArgs e) { Lotto lotto = new Lotto(); string selectedGame = cbGame.Text; int draws = int.Parse(txtDraws.Text); switch (selectedGame) { case "Lotto": lotto.SetupGame(selectedGame, draws); break; case "Viking Lotto": lotto.SetupGame(selectedGame, draws); break; case "EuroJackpot": lotto.SetupGame(selectedGame, draws); break; default: break; } rollNumbers(lotto); }
private void rollNumbers(Lotto lotto) { for (int i = 0; i < lotto.TotalDraws; i++) { int[] numbers = lotto.GetPrimaryNumbers(); int[] specials = lotto.GetSpecialNumbers(numbers); printResults(lotto, numbers, specials); } }
protected void btnDraw_Click(object sender, EventArgs e) { JAMK.IT.IIO11300.Lotto lotto = new JAMK.IT.IIO11300.Lotto(ddlType.SelectedItem.Text); try { int lines = int.Parse(txtLines.Text); lblOutput.Text = lotto.DrawNumbers(lines); } catch (Exception ex) { lblOutput.Text = ex.Message; } }
private void btnDraw_Click(object sender, RoutedEventArgs e) { try { string type = cbGame.SelectedValue.ToString(); int drawns = int.Parse(tbDrawns.Text); Lotto lotto = new Lotto(type); tbNumbers.Text = lotto.DrawNumbers(drawns); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void printResults(Lotto lotto, int[] numbers, int[] specials) { Paragraph para = new Paragraph(); FlowDocument doc = txtNumbers.Document; para.Margin = new Thickness(0); for (int i = 0; i < numbers.Length; i++) { Run run = new Run(numbers[i].ToString() + " "); para.Inlines.Add(run); } if (lotto.SelectedGame != "Viking Lotto") { for (int i = 0; i < specials.Length; i++) { Run run = new Run(specials[i].ToString() + " "); run.Foreground = Brushes.Red; para.Inlines.Add(run); } } doc.Blocks.Add(para); txtNumbers.AppendText("\n"); }
// Consturctors public BusinessLogic() { lotto = new Lotto(); }