diff --git a/VECTO3GUI2020/Properties/Strings.Designer.cs b/VECTO3GUI2020/Properties/Strings.Designer.cs index af84e5633a9257dd60f50d7ca04b2e824027375b..f6ed81b6119d8487f88808a75d73483276c44400 100644 --- a/VECTO3GUI2020/Properties/Strings.Designer.cs +++ b/VECTO3GUI2020/Properties/Strings.Designer.cs @@ -276,6 +276,15 @@ namespace VECTO3GUI2020.Properties { } } + /// <summary> + /// Looks up a localized string similar to Heat Pump Mode. + /// </summary> + public static string HeatPumpMode { + get { + return ResourceManager.GetString("HeatPumpMode", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to Heat Pump Mode Driver. /// </summary> @@ -294,6 +303,15 @@ namespace VECTO3GUI2020.Properties { } } + /// <summary> + /// Looks up a localized string similar to Heat Pump Type. + /// </summary> + public static string HeatPumpType { + get { + return ResourceManager.GetString("HeatPumpType", resourceCulture); + } + } + /// <summary> /// Looks up a localized string similar to Heat Pump Type Driver. /// </summary> diff --git a/VECTO3GUI2020/Properties/Strings.resx b/VECTO3GUI2020/Properties/Strings.resx index 7b1d0f376e31a205e44482cad77e26d36b669a5a..25e87f6f23c6530b2a2868dbffec73b6cbcd8cc4 100644 --- a/VECTO3GUI2020/Properties/Strings.resx +++ b/VECTO3GUI2020/Properties/Strings.resx @@ -319,4 +319,10 @@ <data name="TransferredAirDragArea" xml:space="preserve"> <value>Transferred Airdrag Area</value> </data> + <data name="HeatPumpMode" xml:space="preserve"> + <value>Heat Pump Mode</value> + </data> + <data name="HeatPumpType" xml:space="preserve"> + <value>Heat Pump Type</value> + </data> </root> \ No newline at end of file diff --git a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs index a5df8e7c217ca6ad96ca11d4a8380f29484aca0a..ad44783039c8b070b744ed533de5947710fd64bb 100644 --- a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs +++ b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs @@ -85,7 +85,11 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter if (_inputData.HVACAux != null) { var hvacElement = new XElement(_defaultNamespace + "HVAC"); hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_SystemConfiguration, _inputData.HVACAux.SystemConfiguration.GetXmlFormat())); - hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_HeatPumpTypeDriver, _inputData.HVACAux.HeatPumpTypeDriverCompartment.GetLabel())); + var heatPumpTypeLabel = _inputData.HVACAux.HeatPumpTypeDriverCompartment.GetLabel(); + if (heatPumpTypeLabel == "~null~") { + heatPumpTypeLabel = null; + } + hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_HeatPumpTypeDriver, heatPumpTypeLabel)); hvacElement.Add(new XElement(_defaultNamespace + XMLNames.Bus_HeatPumpModeDriver, _inputData.HVACAux.HeatPumpModeDriverCompartment.GetLabel())); //TODO if (_inputData.HVACAux.HeatPumpPassengerCompartments != null) { diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs index e431ae06740b63fcada94ecf0f2e135a53ba1bee..6bc132b840303d36db92cae06d51ea6ce37f600e 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageAuxiliariesViewModel.cs @@ -47,7 +47,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation { ConsolidatedInputData = consolidatedAuxiliariesInputData; if (ConsolidatedInputData?.HVACAux?.HeatPumpPassengerCompartments != null) { - ConsolidatedHeatPumpConfigurationsPassenger = new ObservableCollection<HeatPumpConfiguration>(); + _consolidatedHeatPumpConfigurationsPassenger = new ObservableCollection<HeatPumpConfiguration>(); foreach (var (heatPumpType, heatPumpMode) in ConsolidatedInputData?.HVACAux?.HeatPumpPassengerCompartments) { ConsolidatedHeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration() { @@ -361,7 +361,13 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public ICommand AddPassengerHeatpumpCommand { get => _addPassengerHeatpumpCommand ?? - new RelayCommand(() => HeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration()), + new RelayCommand(() => { + HeatPumpGroupEditingEnabled = true; + if (HeatPumpConfigurationsPassenger == null) { + HeatPumpConfigurationsPassenger = new ObservableCollection<HeatPumpConfiguration>(); + } + HeatPumpConfigurationsPassenger.Add(new HeatPumpConfiguration()); + }, () => true); } @@ -370,7 +376,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation public ICommand RemovePassengerHeatpumpCommand { get => _removePasssengerHeatpumpCommand ?? - new RelayCommand<HeatPumpConfiguration>(hp => HeatPumpConfigurationsPassenger.Remove(hp), (hp) => true); + new RelayCommand<HeatPumpConfiguration>(hp => HeatPumpConfigurationsPassenger?.Remove(hp), (hp) => true); } public IList<Tuple<HeatPumpType, HeatPumpMode>> HeatPumpPassengerCompartments{ @@ -383,11 +389,19 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation return list; } } - public ObservableCollection<HeatPumpConfiguration> ConsolidatedHeatPumpConfigurationsPassenger { get; } + public ObservableCollection<HeatPumpConfiguration> ConsolidatedHeatPumpConfigurationsPassenger + { + get => _consolidatedHeatPumpConfigurationsPassenger; + private set => SetProperty(ref _consolidatedHeatPumpConfigurationsPassenger, value); + } - public ObservableCollection<HeatPumpConfiguration> HeatPumpConfigurationsPassenger { get; } = - new ObservableCollection<HeatPumpConfiguration>(); + + public ObservableCollection<HeatPumpConfiguration> HeatPumpConfigurationsPassenger + { + get => _heatPumpConfigurationsPassenger; + private set => SetProperty(ref _heatPumpConfigurationsPassenger, value); + } public class HeatPumpConfiguration : ViewModelBase, ITuple, IDataErrorInfo { @@ -505,6 +519,9 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation _parameterViewModels[nameof(HeatPumpModeDriverCompartment)].EditingEnabled = value; _parameterViewModels[nameof(HeatPumpTypeDriverCompartment)].EditingEnabled = value; _parameterViewModels[nameof(SystemConfiguration)].EditingEnabled = value; + if (value == false) { + HeatPumpConfigurationsPassenger = null; + } } } } @@ -635,6 +652,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation private CompressorDrive _compressorDrive; private Dictionary<string, MultistageParameterViewModel> _parameterViewModels; + private ObservableCollection<HeatPumpConfiguration> _consolidatedHeatPumpConfigurationsPassenger; + private ObservableCollection<HeatPumpConfiguration> _heatPumpConfigurationsPassenger; public CompressorDrive CompressorDrive diff --git a/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml b/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml index 637a42d957cab6525a0b0024815c124c260b694b..d7be002ca96dedebe96aeebacd63cf47de27fb1e 100644 --- a/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml +++ b/VECTO3GUI2020/Views/Multistage/ManufacturingStageAuxiliariesView.xaml @@ -8,7 +8,7 @@ xmlns:impl="clr-namespace:VECTO3GUI2020.ViewModel.MultiStage.Implementation" xmlns:properties="clr-namespace:VECTO3GUI2020.Properties" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800" BorderBrush="{DynamicResource ButtonHighlightColor}" BorderThickness="2" Margin="4" + d:DesignHeight="450" d:DesignWidth="800" BorderBrush="{DynamicResource ButtonHighlightColor}" BorderThickness="3" Margin="4" d:DataContext="{d:DesignInstance impl:MultistageAuxiliariesViewModel}"> <UserControl.Resources> <Style TargetType="customControls:MultiStageParameter"> @@ -32,62 +32,67 @@ <ContentControl Content="{Binding ParameterViewModels[PositionlightsLED]}"/> <ContentControl Content="{Binding ParameterViewModels[BrakelightsLED]}"/> <ContentControl Content="{Binding ParameterViewModels[HeadlightsLED]}"/> - + <Label Style="{DynamicResource LabelStyle1}">Heating, Ventilation and Air Conditioning</Label> <ContentControl Content="{Binding ParameterViewModels[SystemConfiguration]}"/> <ContentControl Content="{Binding ParameterViewModels[HeatPumpTypeDriverCompartment]}"/> <ContentControl Content="{Binding ParameterViewModels[HeatPumpModeDriverCompartment]}"/> - <Label Padding="10 4 0 4" Style="{DynamicResource LabelStyle1}">Consolidated Data</Label> - <ItemsControl + <Border Margin="5 0" BorderBrush="{DynamicResource ButtonHighlightColor}" BorderThickness="2" > + <StackPanel Margin="0"> + <Label Margin="0" Style="{DynamicResource LabelStyle1}">Heat Pumps Passenger Compartment</Label> + <Label Padding="10 4 0 4" Style="{DynamicResource LabelStyle1}">Consolidated Data</Label> + <ItemsControl Visibility="{Binding ConsolidatedHeatPumpConfigurationsPassenger, Converter={StaticResource NullToVisibilityConverter}}" ItemsSource="{Binding ConsolidatedHeatPumpConfigurationsPassenger}" HorizontalContentAlignment="Stretch" Padding="5 5 29 5 " > - <ItemsControl.ItemTemplate> - <DataTemplate> - <Border BorderThickness="1"> - <DockPanel LastChildFill="true"> - <UniformGrid DockPanel.Dock="Left" Columns="2"> - <ContentControl Grid.Column="0" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpTypeVM}"/> - <ContentControl Grid.Column="1" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpModeVM}"/> - </UniformGrid> - </DockPanel> - </Border> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - <Label Visibility="{Binding ConsolidatedHeatPumpConfigurationsPassenger, + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border BorderThickness="1"> + <DockPanel LastChildFill="true"> + <UniformGrid DockPanel.Dock="Left" Columns="2"> + <ContentControl Grid.Column="0" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpTypeVM}"/> + <ContentControl Grid.Column="1" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpModeVM}"/> + </UniformGrid> + </DockPanel> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <Label Visibility="{Binding ConsolidatedHeatPumpConfigurationsPassenger, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=invert}" - HorizontalAlignment="Center"> No consolidated data available </Label> - <DockPanel LastChildFill="true"> - <Button DockPanel.Dock="right" ContentTemplate="{DynamicResource AddIcon}" Command="{Binding AddPassengerHeatpumpCommand}"> + HorizontalAlignment="Center">No consolidated data available</Label> + <DockPanel LastChildFill="true"> + <Button DockPanel.Dock="right" ContentTemplate="{DynamicResource AddIcon}" Command="{Binding AddPassengerHeatpumpCommand}"> - </Button> - <Label Style="{DynamicResource LabelStyle1}" Padding="10 4 0 4">Current Stage</Label> - </DockPanel> - - <ItemsControl ItemsSource="{Binding HeatPumpConfigurationsPassenger}" HorizontalContentAlignment="Stretch" + </Button> + <Label Style="{DynamicResource LabelStyle1}" Padding="10 4 0 4">Current Stage</Label> + </DockPanel> + + <ItemsControl ItemsSource="{Binding HeatPumpConfigurationsPassenger}" HorizontalContentAlignment="Stretch" Padding="5"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <Border BorderThickness="1"> - <DockPanel LastChildFill="true"> - <Button DockPanel.Dock="Right" Height="24" + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border BorderThickness="1"> + <DockPanel LastChildFill="true"> + <Button DockPanel.Dock="Right" Height="24" ContentTemplate="{DynamicResource TrashIcon}" Command="{Binding RelativeSource={RelativeSource AncestorType=ItemsControl}, Path=DataContext.RemovePassengerHeatpumpCommand}" CommandParameter="{Binding }"/> - <UniformGrid DockPanel.Dock="Left" Columns="2"> - <ContentControl Grid.Column="0" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpTypeVM}"/> - <ContentControl Grid.Column="1" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpModeVM}"/> - </UniformGrid> - </DockPanel> - </Border> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <UniformGrid DockPanel.Dock="Left" Columns="2"> + <ContentControl Grid.Column="0" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpTypeVM}"/> + <ContentControl Grid.Column="1" DockPanel.Dock="Top" Content="{Binding Path=HeatPumpModeVM}"/> + </UniformGrid> + </DockPanel> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + </Border> <ContentControl Content="{Binding ParameterViewModels[AuxHeaterPower]}"/> diff --git a/Vecto3GUI2020Test/ViewModelTests/VehicleViewModelTests.cs b/Vecto3GUI2020Test/ViewModelTests/VehicleViewModelTests.cs index 82b1b47ac4a9851ea8d0ef9f34cdc97d9d468144..e46e68650e4670b5a084f24f4e42787e0d9db976 100644 --- a/Vecto3GUI2020Test/ViewModelTests/VehicleViewModelTests.cs +++ b/Vecto3GUI2020Test/ViewModelTests/VehicleViewModelTests.cs @@ -72,6 +72,9 @@ namespace Vecto3GUI2020Test.ViewModelTests var vehicleVM = vm.MultiStageJobViewModel.ManufacturingStageViewModel.Vehicle as DeclarationInterimStageBusVehicleViewModel_v2_8; + + + } /// <summary> /// airdrag component is in VIF set => AirdragModifiedMultistage is mandatory