Beispiel #1
0
        /// <summary>
        /// Add aircraft button click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddAircraft_Click(object sender, EventArgs e)
        {
            if (ValidateAircraftInput())
            {
                switch (cmbAircraftType.SelectedIndex)
                {
                case 0:
                    if ((Regex.IsMatch(tbCapacity.Text, @"^\d+$")))
                    {
                        ScenarioController.AddCargoPlane(lsvAirport.FocusedItem.Index, tbAircraftName.Text, Convert.ToInt32(tbSpeed.Text), Convert.ToInt32(tbMaintenance.Text), Convert.ToInt32(tbLoad.Text), Convert.ToInt32(tbUnload.Text), Convert.ToInt32(tbCapacity.Text));
                    }
                    break;

                case 1:
                    if ((Regex.IsMatch(tbCapacity.Text, @"^\d+$")))
                    {
                        ScenarioController.AddPassengerPlane(lsvAirport.FocusedItem.Index, tbAircraftName.Text, Convert.ToInt32(tbSpeed.Text), Convert.ToInt32(tbMaintenance.Text), Convert.ToInt32(tbLoad.Text), Convert.ToInt32(tbUnload.Text), Convert.ToInt32(tbCapacity.Text));
                    }
                    break;

                case 2:
                    ScenarioController.AddObserverPlane(lsvAirport.FocusedItem.Index, tbAircraftName.Text, Convert.ToInt32(tbSpeed.Text), Convert.ToInt32(tbMaintenance.Text));
                    break;

                case 3:
                    ScenarioController.AddRescueHelicopter(lsvAirport.FocusedItem.Index, tbAircraftName.Text, Convert.ToInt32(tbSpeed.Text), Convert.ToInt32(tbMaintenance.Text));
                    break;

                case 4:
                    ScenarioController.AddWaterBomber(lsvAirport.FocusedItem.Index, tbAircraftName.Text, Convert.ToInt32(tbSpeed.Text), Convert.ToInt32(tbMaintenance.Text), 0, 0);
                    break;
                }
            }

            ResetAircraftControls();
        }