예제 #1
0
        public Ambulance GetAmbulance()
        {
            Ambulance ambulance = new Ambulance();

            AmbulanceAssignFields(ambulance);
            return(ambulance);
        }
예제 #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;
            }
        }
예제 #3
0
 private void FillAmbulanceCarState(Ambulance ambulance)
 {
     ambulance.CallNumber   = textBoxCallNumber.Text;
     ambulance.Flasher.IsOn = checkBoxFlasherOn.IsChecked ?? false;
 }