diff --git a/VECTO3GUI2020/Test.xaml b/VECTO3GUI2020/Test.xaml index 6c4ffa323648766ebe311fadec8a2221c3934a0f..883faca601bc6f1988cfd5498581d3e011d9bc94 100644 --- a/VECTO3GUI2020/Test.xaml +++ b/VECTO3GUI2020/Test.xaml @@ -16,6 +16,7 @@ <customControls:MultiStageParameter Content="{Binding ConvertedSI}" DummyContent="{Binding Source={StaticResource milimeterDummy}}"/> <customControls:MultiStageParameter Content="{Binding ConvertedSI1}" DummyContent="{Binding Source={StaticResource milimeterDummy}}"/> <customControls:MultiStageParameter Mode="COMBOBOX" Content="{Binding HeatPumpMode}"></customControls:MultiStageParameter> + <customControls:MultiStageParameter Mode="TEXTBOX" Content="{Binding TestString}"></customControls:MultiStageParameter> </StackPanel> </Grid> </UserControl> diff --git a/VECTO3GUI2020/TestViewModel.cs b/VECTO3GUI2020/TestViewModel.cs index 0cce228ad3e99b696fab76430c6340f766db2a7c..c82ada14bad67af12ea06a1befb38a692f9ce07a 100644 --- a/VECTO3GUI2020/TestViewModel.cs +++ b/VECTO3GUI2020/TestViewModel.cs @@ -35,6 +35,7 @@ namespace VECTO3GUI2020 private Meter _meter; private HeatPumpMode? _heatpumpMode; + private string _testString; public Meter Meter { @@ -48,9 +49,15 @@ namespace VECTO3GUI2020 set => SetProperty(ref _heatpumpMode, value); } + public String TestString + { + get => _testString; + set => SetProperty(ref _testString, value); + } + public TestViewModel() { - + TestString = "Value loaded"; } } } diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs index f49293bda99b4c21b88a68a7694347ca21f7e940..c9dd0c1d1bfdba72acc8cec870686a1caadb9004 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/ManufacturingStageViewModel_v0_1.cs @@ -71,8 +71,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public void SetInputData(IVehicleDeclarationInputData vehicleInputData) { _vehicleViewModel.SetVehicleInputData(vehicleInputData); - _airDragEditViewModel.SetAirdragInputData(vehicleInputData.Components.AirdragInputData); - _auxiliariesViewModel.SetAuxiliariesInputData(vehicleInputData.Components.BusAuxiliaries); + _airDragEditViewModel.SetAirdragInputData(vehicleInputData?.Components?.AirdragInputData); + _auxiliariesViewModel.SetAuxiliariesInputData(vehicleInputData?.Components?.BusAuxiliaries); } diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAirdragViewModel.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAirdragViewModel.cs index 1729b438bfa4c59784970478d8e159a69c42bb7a..0bdfca0590b03cdc95739b1972ff173d0d3cc99a 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAirdragViewModel.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAirdragViewModel.cs @@ -46,8 +46,15 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public void SetAirdragInputData(IAirdragDeclarationInputData airdragInputData) { + if (airdragInputData == null) { + AirDragViewModel = null; + return; + + } AirDragViewModel = _dependencies.ComponentViewModelFactory.CreateComponentViewModel(airdragInputData) as IAirDragViewModel; - + if (AirDragViewModel != null) { + AirDragViewModel.LabelVisible = false; + } } public IAirdragDeclarationInputData ConsolidatedAirdragData diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs index 1fa12b36b0df3d4a28faa620a2c67108f89b2778..2451a7da2d10af5eddf773dbcdd24e5afb0d5041 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs @@ -335,26 +335,54 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation #endregion public void SetAuxiliariesInputData(IBusAuxiliariesDeclarationData componentsAuxiliaryInputData) { - _heatPumpGroupEditingEnabled = componentsAuxiliaryInputData.HVACAux != null; - _systemConfiguration = componentsAuxiliaryInputData.HVACAux?.SystemConfiguration; - _heatPumpTypeDriverCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpTypeDriverCompartment; - _heatPumpModeDriverCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpModeDriverCompartment; - _heatPumpTypePassengerCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpTypePassengerCompartment; - _heatPumpModePassengerCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpModePassengerCompartment; - - _auxHeaterPower = componentsAuxiliaryInputData.HVACAux?.AuxHeaterPower; - _doubleGlazing = componentsAuxiliaryInputData.HVACAux?.DoubleGlazing; - _adjustableAuxiliaryHeater = componentsAuxiliaryInputData.HVACAux?.AdjustableAuxiliaryHeater; - _separateAirDistributionDucts = componentsAuxiliaryInputData.HVACAux?.SeparateAirDistributionDucts; - _waterElectricHeater = componentsAuxiliaryInputData.HVACAux?.WaterElectricHeater; - _airElectricHeater = componentsAuxiliaryInputData.HVACAux?.AirElectricHeater; - _otherHeatingTechnology = componentsAuxiliaryInputData.HVACAux?.OtherHeatingTechnology; - - _interiorLightsLed = componentsAuxiliaryInputData.ElectricConsumers?.InteriorLightsLED; - _dayrunninglightsLed = componentsAuxiliaryInputData.ElectricConsumers?.DayrunninglightsLED; - _positionlightsLed = componentsAuxiliaryInputData.ElectricConsumers?.PositionlightsLED; - _headlightsLed = componentsAuxiliaryInputData.ElectricConsumers?.HeadlightsLED; - _brakelightsLed = componentsAuxiliaryInputData.ElectricConsumers?.BrakelightsLED; + if (componentsAuxiliaryInputData == null) { + return; + } + + HeatPumpGroupEditingEnabled = componentsAuxiliaryInputData.HVACAux != null; + SystemConfiguration = componentsAuxiliaryInputData.HVACAux?.SystemConfiguration; + HeatPumpTypeDriverCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpTypeDriverCompartment; + HeatPumpModeDriverCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpModeDriverCompartment; + HeatPumpTypePassengerCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpTypePassengerCompartment; + HeatPumpModePassengerCompartment = componentsAuxiliaryInputData.HVACAux?.HeatPumpModePassengerCompartment; + + AuxHeaterPower = componentsAuxiliaryInputData.HVACAux?.AuxHeaterPower; + DoubleGlazing = componentsAuxiliaryInputData.HVACAux?.DoubleGlazing; + AdjustableAuxiliaryHeater = componentsAuxiliaryInputData.HVACAux?.AdjustableAuxiliaryHeater; + SeparateAirDistributionDucts = componentsAuxiliaryInputData.HVACAux?.SeparateAirDistributionDucts; + WaterElectricHeater = componentsAuxiliaryInputData.HVACAux?.WaterElectricHeater; + AirElectricHeater = componentsAuxiliaryInputData.HVACAux?.AirElectricHeater; + OtherHeatingTechnology = componentsAuxiliaryInputData.HVACAux?.OtherHeatingTechnology; + + InteriorLightsLED = componentsAuxiliaryInputData.ElectricConsumers?.InteriorLightsLED; + DayrunninglightsLED = componentsAuxiliaryInputData.ElectricConsumers?.DayrunninglightsLED; + PositionlightsLED = componentsAuxiliaryInputData.ElectricConsumers?.PositionlightsLED; + HeadlightsLED = componentsAuxiliaryInputData.ElectricConsumers?.HeadlightsLED; + BrakelightsLED = componentsAuxiliaryInputData.ElectricConsumers?.BrakelightsLED; + } + + private void ResetData() + { + HeatPumpGroupEditingEnabled = false; + SystemConfiguration = null; + HeatPumpTypeDriverCompartment = null; + HeatPumpModeDriverCompartment = null; + HeatPumpTypePassengerCompartment = null; + HeatPumpModePassengerCompartment = null; + + AuxHeaterPower = null; + DoubleGlazing = null; + AdjustableAuxiliaryHeater = null; + SeparateAirDistributionDucts = null; + WaterElectricHeater = null; + AirElectricHeater = null; + OtherHeatingTechnology = null; + + InteriorLightsLED = null; + DayrunninglightsLED = null; + PositionlightsLED = null; + HeadlightsLED = null; + BrakelightsLED = null; } public MultistageAuxiliariesViewModel(IBusAuxiliariesDeclarationData consolidatedAuxiliariesInputData) diff --git a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs index b97980c818cdc77d7d77c72181e9e07f410e0b0f..841c1859b8dfcb1e0d44e05a9393b5f06140944d 100644 --- a/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs +++ b/VECTO3GUI2020/Views/Multistage/CustomControls/MultiStageParameter.xaml.cs @@ -168,18 +168,21 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls if (multiStageParameter.DummyContent == null) { multiStageParameter.DummyContent = multiStageParameter.CreateDummyContent(e, multiStageParameter); } - + if (multiStageParameter.Content != null) { + multiStageParameter.EditingEnabled = true; + } - multiStageParameter.SetListItems(); + if (multiStageParameter.Mode == MultistageParameterViewMode.COMBOBOX) { + multiStageParameter.SetListItems(); + } - if (multiStageParameter.LabelText != null) { - return; + if (multiStageParameter.LabelText == null) { + multiStageParameter.LabelText = multiStageParameter.GetLabelByPropertyName( + MultiStageParameter.ContentProperty, + Strings.ResourceManager); } - multiStageParameter.LabelText = multiStageParameter.GetLabelByPropertyName( - MultiStageParameter.ContentProperty, - Strings.ResourceManager); } private void SetListItems() @@ -248,11 +251,13 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls private static void EditingEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MultiStageParameter multiStageParameter = (MultiStageParameter)d; - if((bool)e.NewValue == false) - { + if((bool)e.NewValue == false) { + multiStageParameter.DummyContent = multiStageParameter.Content; multiStageParameter.Content = null; } else { - if (multiStageParameter.DummyContent != null) { + if (multiStageParameter.Content != null) { + multiStageParameter.DummyContent = multiStageParameter.Content; + }else if (multiStageParameter.DummyContent != null) { multiStageParameter.Content = multiStageParameter.DummyContent; } } @@ -267,8 +272,6 @@ namespace VECTO3GUI2020.Views.Multistage.CustomControls public MultiStageParameter() { InitializeComponent(); - - //LabelText = this.GetLabelByPropertyName(ContentProperty, Strings.ResourceManager); } private void Control_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)