Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            while (numCounter < 6)
            {
                using (InputDialog form = new InputDialog())
                {
                    var formResult = form.ShowDialog();

                    bool ingresoCero    = form.ingresoCero;
                    bool usuarioCancelo = form.usuarioCancelo;
                    if (formResult == DialogResult.OK)
                    {
                        if (ingresoCero)
                        {
                            btnIniciar.Enabled = false;
                            break;
                        }
                        if (!usuarioCancelo)
                        {
                            numCounter++;
                        }
                    }
                }
            }
            btnIniciar.Enabled = false;
            this.Text          = numCounter.ToString();
            ShowListas verListas = new ShowListas();

            verListas.Pares   = Pares.getListPares();
            verListas.Impares = Impares.getListImpares();

            verListas.ShowDialog();
        }
Beispiel #2
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            int  num   = 0;
            bool esPar = true;

            try
            {
                num = Convert.ToInt32(txtNumber.Text);
                if (num != 0)
                {
                    ingresoCero = false;
                    esPar       = Comprobaciones.checkNum(num);
                    if (esPar == true)
                    {
                        Pares.addToPares(num);
                    }
                    else
                    {
                        Impares.addToImpares(num);
                    }
                }
                else
                {
                    MessageBox.Show("El numero ingresado es 0. Ingreso Finalizado", "Ingreso terminado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    ingresoCero = true;
                }
                DialogResult = DialogResult.OK;
            }
            catch (Exception excepcion)
            {
                MessageBox.Show("ERROR: " + excepcion.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }