Ejemplo n.º 1
0
        // VEHICULO
        private void AddVehicleButton_Click(object sender, EventArgs e)
        {
            if (OnAgregarVehiculo != null && this.cilindradaTextBox.Text != "" && this.marcaTextBox.Text != "" && this.vehicleTeamComboBox.SelectedItem != null)
            {
                AgregarVehiculoEventArgs vehicleArgs = new AgregarVehiculoEventArgs();
                int x = 0;

                if (Int32.TryParse(this.cilindradaTextBox.Text, out x))
                {
                    vehicleArgs.marca      = this.marcaTextBox.Text;
                    vehicleArgs.cilindrada = x;
                    vehicleArgs.equipo     = this.vehicleTeamComboBox.SelectedIndex;
                    OnAgregarVehiculo(this, vehicleArgs);
                    MessageBox.Show("Vehiculo agregado");
                    this.marcaTextBox.Text                = "";
                    this.cilindradaTextBox.Text           = "";
                    this.vehicleTeamComboBox.SelectedItem = null;
                }
                else
                {
                    MessageBox.Show("Porfavor elige una cilindrada correcta");
                }
            }
            else
            {
                MessageBox.Show("Porfavor agrega todos los datos");
            }
        }
        private void VistaPilotos_OnAgregarVehiculo(object sender, AgregarVehiculoEventArgs e)
        {
            Vehiculo vehiculo = new Vehiculo(e.marca, e.cilindrada);

            Vehiculos.Add(vehiculo);
            Equipos[e.equipo].AgregarVehiculos(vehiculo);
        }
 private void DoneVehiculoButton_Click(object sender, EventArgs e)
 {
     if (OnAgregarVehiculo != null)
     {
         AgregarVehiculoEventArgs vehiculo = new AgregarVehiculoEventArgs();
         vehiculo.marca      = this.MarcaTextBox.Text;
         vehiculo.cilindrada = Convert.ToInt32(this.CilindradaUpDown.Value);
         OnAgregarVehiculo(this, vehiculo);
         VehiculoPanel.Visible = false;
     }
 }