Exemplo n.º 1
0
        public PassengerCar GetPassengerCar()
        {
            PassengerCar passengerCar = new PassengerCar();

            PassengerCarAssignFields(passengerCar);
            return(passengerCar);
        }
Exemplo n.º 2
0
        private void UpdateFields(Car car)
        {
            textBoxName.Text           = car.Name;
            textBoxNumber.Text         = car.Number;
            textBoxHP.Text             = car.HorsePower.ToString();
            textBoxSpeed.Text          = car.Speed.ToString();
            textBoxMaxSpeed.Text       = car.MaxSpeed.ToString();
            textBoxWeight.Text         = car.Weight.ToString();
            textBoxColor.Text          = car.Color;
            checkBoxEngineOn.IsChecked = car.EngineOn;

            if (car is PassengerCar)
            {
                PassengerCar pcar = car as PassengerCar;
                textBoxTotalSeats.Text       = pcar.TotalSeats.ToString();
                textBoxPassengers.Text       = pcar.PassengersCount.ToString();
                checkBoxFrontDrive.IsChecked = pcar.FrontDrive;
            }
            if (car is TrailerTruck)
            {
                TrailerTruck ttruck = car as TrailerTruck;
                textBoxGoods.Text            = ttruck.Goods;
                textBoxMaxTrailerWeight.Text = ttruck.MaxTrailerWeight.ToString();
                textBoxTrailerWeight.Text    = ttruck.TrailerWeight.ToString();
                checkBoxHasTrailer.IsChecked = ttruck.HasTrailer;
            }

            if (car is Ambulance)
            {
                Ambulance ambulance = car as Ambulance;
                textBoxCallNumber.Text          = ambulance.CallNumber;
                checkBoxFlasherOn.IsChecked     = ambulance.Flasher.IsOn;
                checkBoxPatientInside.IsChecked = ambulance.PatientInside;
            }
        }
Exemplo n.º 3
0
 private void FillPassengerCarState(PassengerCar pc)
 {
     pc.TotalSeats      = int.Parse(textBoxTotalSeats.Text);
     pc.PassengersCount = int.Parse(textBoxPassengers.Text);
     pc.FrontDrive      = checkBoxFrontDrive.IsChecked ?? false;
 }