From fc27dbd27b4aa7f6aafa334463794cd4894e51e8 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Tue, 26 Apr 2022 17:56:56 +0200 Subject: [PATCH] VehicleForm: Solved Problem of Binding for Tabs of EM and GENSet by setting the BindingContext again --- VECTO/GUI/VehicleForm.vb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 5f756f7ffd..0b902ef001 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -461,8 +461,8 @@ Public Class VehicleForm tbEmADCLossMap.Text = If(em.MechanicalTransmissionLossMap Is Nothing, em.MechanicalTransmissionEfficiency.ToGUIFormat(), GetRelativePath(em.MechanicalTransmissionLossMap.Source, basePath)) tbRatioEm.Text = em.RatioADC.ToGUIFormat() + cbEmPos.SelectedValue = em.Position - UpdateRetarderPosition(em.Position) If (em.Position = PowertrainPosition.HybridP2_5) AndAlso Not em.RatioPerGear Is Nothing Then lvRatioPerGear.Items.Clear() @@ -545,6 +545,7 @@ Public Class VehicleForm cbEcoRoll.Enabled = True If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then tcVehicleComponents.TabPages.Insert(2, tpElectricComponents) + tpElectricComponents.BindingContext = BindingContext End If Case VectoSimulationJobType.SerialHybridVehicle gbRetarderLosses.Enabled = False @@ -559,6 +560,7 @@ Public Class VehicleForm gbEMTorqueLimits.Enabled = False If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then tcVehicleComponents.TabPages.Insert(2, tpElectricComponents) + tpElectricComponents.BindingContext = BindingContext End If If Not tcVehicleComponents.TabPages.Contains(tpGensetComponents) Then tcVehicleComponents.TabPages.Insert(3, tpGensetComponents) @@ -579,13 +581,16 @@ Public Class VehicleForm gbEMTorqueLimits.Enabled = False If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then tcVehicleComponents.TabPages.Insert(2, tpElectricComponents) + tpElectricComponents.BindingContext = BindingContext End If Case Else If Not tcVehicleComponents.TabPages.Contains(tpElectricComponents) Then tcVehicleComponents.TabPages.Insert(2, tpElectricComponents) + tpElectricComponents.BindingContext = BindingContext End If If Not tcVehicleComponents.TabPages.Contains(tpGensetComponents) Then tcVehicleComponents.TabPages.Insert(3, tpGensetComponents) + tpGensetComponents.BindingContext = BindingContext End If End Select @@ -1235,20 +1240,15 @@ Public Class VehicleForm Private Sub cbEmPos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbEmPos.SelectedIndexChanged gbRatiosPerGear.Enabled = PowertrainPosition.HybridP2_5.Equals(cbEmPos.SelectedValue) - UpdateRetarderPosition(CType(cbEmPos.SelectedValue, PowertrainPosition)) - End Sub - - - Private Sub UpdateRetarderPosition(pos As PowertrainPosition) Dim selectedValue = CbRtType.SelectedValue - If PowertrainPosition.BatteryElectricE4.Equals(pos) OrElse PowertrainPosition.BatteryElectricE2.Equals(pos) Then + If PowertrainPosition.BatteryElectricE4.Equals(cbEmPos.SelectedValue) OrElse PowertrainPosition.BatteryElectricE2.Equals(cbEmPos.SelectedValue) Then gbRetarderLosses.Enabled = False TbRtRatio.Text = "" TbRtPath.Text = "" CbRtType.SelectedIndex = 0 CType(CbRtType.DataSource, DataView).RowFilter = $"Key <> {CInt(RetarderType.AxlegearInputRetarder)}" - ElseIf PowertrainPosition.BatteryElectricE3.Equals(pos) Then + ElseIf PowertrainPosition.BatteryElectricE3.Equals(cbEmPos.SelectedValue) Then gbRetarderLosses.Enabled = True CType(CbRtType.DataSource, DataView).RowFilter = $"Key in ({CInt(RetarderType.None)}, {CInt(RetarderType.AxlegearInputRetarder)})" Else -- GitLab