示例#1
0
        private void PreencheCartela(Cartela cartela)
        {
            if (numCartela > 3)
            {
                numCartela = 0;
            }
            GroupBox gb = listGB[numCartela++];

            gb.Tag  = cartela;
            gb.Text = string.Format(nomeCartela, cartela.GetCodigo(), cartela.NumerosSorteados());

            foreach (TextBox tb in GetTextBoxControls(gb))
            {
                int nAtual = (cartela.GetNumeros())[tb.TabIndex];
                if (nAtual == 0)
                {
                    tb.Text = "";
                }
                else
                {
                    if (nAtual < 10)
                    {
                        tb.Text = "0";
                    }
                    tb.Text += "" + nAtual;
                }
            }
        }
示例#2
0
        private void CarregaCartelas()
        {
            StreamReader  sr       = File.OpenText("lstCartelas.txt");
            List <string> lCartela = new List <string>();

            while (!sr.EndOfStream)
            {
                lCartela.Add(sr.ReadLine());
            }
            sr.Close();

            foreach (string cartela in lCartela)
            {
                if (cartela.Trim().Length > 0 && cartela.IndexOf(';') > 0)
                {
                    string[] tmp = cartela.Split(';');
                    if (!dicCartelas.ContainsKey(tmp[0]))
                    {
                        Cartela c = new Cartela(tmp[0], tmp[1]);
                        dicCartelas.Add(c.GetCodigo(), c);
                        listCartelas.Add(c);
                    }
                }
            }
        }