Exemplo n.º 1
0
        /// <summary>
        /// Evento utilizado para abrir el segundo formulario -> generar el mapa con los datos ingresados previamente
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            int intCalles   = -1;
            int intAvenidas = -1;

            if (Validador.esEntero(txtAvenidas.Text))
            {
                intCalles = int.Parse(txtAvenidas.Text);
            }
            if (Validador.esEntero(txtCalles.Text))
            {
                intAvenidas = int.Parse(txtCalles.Text);
            }

            if (txtAddress.Text == "")
            {
                MessageBox.Show("Por favor realice la carga de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Console.WriteLine(dtpFechaHora.ToString());
                Viewer v1 = new Viewer(intCalles, intAvenidas, dtpFechaHora.Value, this, alObjetos);
                v1.ShowDialog();
                this.Hide();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Evento utilizado para validar que el número de calles y avenidas se encuentre dentro del rango establecido
        /// </summary>
        private void button1_MouseClick(object sender, MouseEventArgs e)
        {
            int intCalles   = -1;
            int intAvenidas = -1;

            if (Validador.esEntero(txtAvenidas.Text))
            {
                intCalles = int.Parse(txtAvenidas.Text);
            }
            if (Validador.esEntero(txtCalles.Text))
            {
                intAvenidas = int.Parse(txtCalles.Text);
            }
            if (intCalles != -1 && intCalles != -1)
            {
                if (intCalles < 10 || intCalles > 50)
                {
                    MessageBox.Show("La cantidad de calles debe estar entre 10 y 50.", "***ERROR***", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtAvenidas.Text = "";
                }
                else if (intAvenidas < 10 || intCalles > 100)
                {
                    MessageBox.Show("La cantidad de avenidas debe estar entre 10 y 50.", "***ERROR***", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtAvenidas.Text = "";
                }
                else
                {
                    Console.WriteLine(dtpFechaHora.ToString());
                    Viewer v1 = new Viewer(intCalles, intAvenidas, dtpFechaHora.Value, this, alObjetos);
                    v1.ShowDialog();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Debe ingresar datos válidos", "***ERROR***", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }