Ejemplo n.º 1
0
        private void validarFormulariNewEntry()
        {
            bool lapsValid = false;
            int  laps      = -1;

            tempsPrimerPilot();
            tempsAltresPilots();

            try
            {
                if (txtLaps.Text != null)
                {
                    laps = Int32.Parse(txtLaps.Text);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            if (laps >= 0 && laps <= CircuitDB.getLaps(((CircuitDB)lsvCircuits.SelectedItem).Id))
            {
                lapsValid = true;
            }

            btnAddDriver.IsEnabled = (tempsPrimerPilot() || tempsAltresPilots()) && lapsValid && gdvPilotsUnasignedTeam.SelectedItem != null;
        }