예제 #1
0
        private void botoes_Click(object sender, EventArgs e)
        {
            Button     btn = (Button)sender;
            classBingo b   = new classBingo();

            for (int i = 0; i < b.qtdSaiu; i++)
            {
                if (btn.Text == b.numSorteados.GetValue(i).ToString())
                {
                    btn.Enabled = false;
                    contGanhou++;
                }
            }
            if (contGanhou == 24)
            {
                MessageBox.Show("Parabéns Cartela " + this.Id + "! Você ganhou o jogo :D");
                Form[] forms = Application.OpenForms.Cast <Form>().ToArray();
                foreach (Form f in forms)
                {
                    if (f.Name == "Bingo")
                    {
                        f.MainMenuStrip.Items[0].Enabled = true;
                        f.MainMenuStrip.Items[1].Enabled = false;
                        f.MainMenuStrip.Items[2].Enabled = false;
                    }
                    else
                    {
                        f.Close();
                    }
                }
            }
        }
예제 #2
0
 private void botoes_Click(object sender, EventArgs e)
 {
     Button btn = (Button)sender;
     classBingo b = new classBingo();
     for (int i = 0; i < b.qtdSaiu; i++)
         if (btn.Text == b.numSorteados.GetValue(i).ToString())
         {
             btn.Enabled = false;
             contGanhou++;
         }
     if (contGanhou == 24)
     {
         MessageBox.Show("Parabéns Cartela " + this.Id + "! Você ganhou o jogo :D");
         Form[] forms = Application.OpenForms.Cast<Form>().ToArray();
         foreach (Form f in forms)
         {
             if (f.Name == "Bingo")
             {
                 f.MainMenuStrip.Items[0].Enabled = true;
                 f.MainMenuStrip.Items[1].Enabled = false;
                 f.MainMenuStrip.Items[2].Enabled = false;                       
             }
             else f.Close();
         }
     }
 }
예제 #3
0
        public void clicarSortear()
        {
            classBingo b = new classBingo();

            Form[] forms = Application.OpenForms.Cast <Form>().ToArray();
            foreach (Form f in forms)
            {
                if (f.Name == "Sorteio")
                {
                    if (contNumSaiu < 75)
                    {
                        f.Controls["lblSorteado"].Text = ArraySorteados.GetValue(contNumSaiu).ToString();
                        ListBox[] lb = f.Controls.OfType <ListBox>().ToArray();
                        foreach (ListBox l in lb)
                        {
                            if (l.Name == "listBox1")
                            {
                                l.Items.Add(f.Controls["lblSorteado"].Text);
                            }
                        }
                        contNumSaiu++;
                        b.qtdSaiu++;
                    }
                    else
                    {
                        f.Controls["lblSorteado"].Text   = "--";
                        f.Controls["btnSortear"].Enabled = false;
                    }
                }
            }
        }
예제 #4
0
 public void clicarSortear()
 {
     classBingo b = new classBingo();
     Form[] forms = Application.OpenForms.Cast<Form>().ToArray();
     foreach (Form f in forms)
     {
         if (f.Name == "Sorteio")
         {
             if (contNumSaiu < 75)
             {
                 f.Controls["lblSorteado"].Text = ArraySorteados.GetValue(contNumSaiu).ToString();
                 ListBox[] lb = f.Controls.OfType<ListBox>().ToArray();
                 foreach (ListBox l in lb)
                     if (l.Name == "listBox1") l.Items.Add(f.Controls["lblSorteado"].Text);
                 contNumSaiu++;
                 b.qtdSaiu++;
             }
             else
             {
                 f.Controls["lblSorteado"].Text = "--";
                 f.Controls["btnSortear"].Enabled = false;
             }
         }
     }
 }
예제 #5
0
 private int[] sortear()
 {
     for (int i = 1; i <= 75; i++) ArraySorteados[i - 1] = i;
     Random ran = new Random();
     for (int i = 0; i < ArraySorteados.Length; i++)
     {
         int pos = ran.Next(1, 75);
         int temp = ArraySorteados[i];
         ArraySorteados[i] = ArraySorteados[pos];
         ArraySorteados[pos] = temp;
     }
     classBingo b = new classBingo();
     b.numSorteados = ArraySorteados;
     return ArraySorteados;
 }
예제 #6
0
        private int[] sortear()
        {
            for (int i = 1; i <= 75; i++)
            {
                ArraySorteados[i - 1] = i;
            }
            Random ran = new Random();

            for (int i = 0; i < ArraySorteados.Length; i++)
            {
                int pos  = ran.Next(1, 75);
                int temp = ArraySorteados[i];
                ArraySorteados[i]   = ArraySorteados[pos];
                ArraySorteados[pos] = temp;
            }
            classBingo b = new classBingo();

            b.numSorteados = ArraySorteados;
            return(ArraySorteados);
        }