Exemplo n.º 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);
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
 }
Exemplo n.º 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");
 }
Exemplo n.º 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");
        }
Exemplo n.º 10
0
 // Consturctors
 public BusinessLogic()
 {
     lotto = new Lotto();
 }
Exemplo n.º 11
0
 // Consturctors
 public BusinessLogic()
 {
   lotto = new Lotto();
 }