public FormServiceAVehicle(VehicleRentalManagement mangerInstance, Vehicle vehicleInstance) { InitializeComponent(); this.manager = mangerInstance; this.vehicleNeedServicing = vehicleInstance; this.serviceLog = vehicleNeedServicing.GetServiceHistory; this.serviceLog.RegisterObserver(this); this.EngineStateComboBox.Text = vehicleNeedServicing.EngineState.ToString(); this.TranmissionStateComboBox.Text = vehicleNeedServicing.TransmissionState.ToString(); this.TiresStateComboBox.Text = vehicleNeedServicing.TiresState.ToString(); PopulateComboboxOption(); DisplayPossibleServices(); Display(); // Load combobox options to manually set the states of the vehicle part: }
// Implementing the interface IObserver: public void Update(ISubject subject) { serviceLog = (ServiceHistory)subject; Display(); }