Exemple #1
0
 private void FillTrailerTruckState(TrailerTruck ttruck)
 {
     ttruck.Goods            = textBoxGoods.Text;
     ttruck.MaxTrailerWeight = int.Parse(textBoxTrailerWeight.Text);
     ttruck.TrailerWeight    = int.Parse(textBoxMaxTrailerWeight.Text);
     ttruck.HasTrailer       = checkBoxHasTrailer.IsChecked ?? false;
 }
Exemple #2
0
        public TrailerTruck GetTrailerTruck()
        {
            TrailerTruck trailerTruck = new TrailerTruck();

            TrailerTruckAssignFields(trailerTruck);
            return(trailerTruck);
        }
Exemple #3
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;
            }
        }