Beispiel #1
0
        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);
        }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
 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);
            }
        }
Beispiel #6
0
        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);
            }
        }
Beispiel #7
0
 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);
 }
Beispiel #8
0
 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");
 }
Beispiel #9
0
        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");
        }
Beispiel #10
0
 // Consturctors
 public BusinessLogic()
 {
     lotto = new Lotto();
 }
Beispiel #11
0
 // Consturctors
 public BusinessLogic()
 {
   lotto = new Lotto();
 }