Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit d46fee70 authored by Franz KOBER josef's avatar Franz KOBER josef
Browse files

Merge branch 'feature/VECTO-1190-d-m-heavy-busesK' into VECTO_GUI

parents b79b6f61 bce176f1
No related branches found
No related tags found
No related merge requests found
Showing
with 152 additions and 136 deletions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Channels;
using System.Text;
using System.Threading.Tasks;
using VECTO3GUI.ViewModel.Impl;
namespace VECTO3GUI.Model
{
//public enum AlternatorTechnology
//{
// Empty,
// Default
//}
//public static class AlternatorTechnologyHelper
//{
// public static string GetLabel(this AlternatorTechnology technology)
// {
// switch (technology) {
// case AlternatorTechnology.Default:
// return nameof(AlternatorTechnology.Default).ToLower();
// default:
// return string.Empty;
// }
// }
// public static AlternatorTechnology Parse(string technologyName)
// {
// switch (technologyName.ToLower()) {
// case "default":
// return AlternatorTechnology.Default;
// default:
// return AlternatorTechnology.Empty;
// }
// }
//}
public class AlternatorTechnologyModel : ObservableObject
{
public string _alternatorTechnology;
......
......@@ -17,16 +17,17 @@ namespace VECTO3GUI.Model.TempDataObject
public string Model { get; set; }
public string CertificationNumber { get; set; }
public DateTime? Date { get; set; }
public bool NoAirdragData { get; set; }
public bool UseMeasuredValues { get; set; }
public SquareMeter CdxA_0 { get; set; }
public SquareMeter TransferredCdxA { get; set; }
public SquareMeter DeclaredCdxA { get; set; }
public string AppVersion { get; set; }
public DigestData DigestValue { get; set; }
public bool NoAirdragData { get; set; }
public bool UseMeasurementData { get; set; }
#endregion
public AirdragComponentData(){}
......@@ -34,6 +35,8 @@ namespace VECTO3GUI.Model.TempDataObject
{
if(defaultValues)
ClearValues(viewModel);
UseMeasurementData = viewModel.UseMeasurementData;
NoAirdragData = viewModel.NoAirdragData;
}
public AirdragComponentData(IAirdragViewModel airdrag)
......@@ -48,6 +51,7 @@ namespace VECTO3GUI.Model.TempDataObject
public void ResetToComponentValues(IAirdragViewModel viewModel)
{
viewModel.UseMeasurementData = UseMeasurementData;
viewModel.NoAirdragData = NoAirdragData;
viewModel.Model = Model;
viewModel.Manufacturer = Manufacturer;
......@@ -75,6 +79,7 @@ namespace VECTO3GUI.Model.TempDataObject
private void SetValues(IAirdragViewModel viewModel)
{
UseMeasurementData = viewModel.UseMeasurementData;
NoAirdragData = viewModel.NoAirdragData;
Model = viewModel.Model;
Manufacturer = viewModel.Manufacturer;
......
......@@ -42,6 +42,8 @@ namespace VECTO3GUI.Model.TempDataObject
AlternatorTechnologies = new ObservableCollectionEx<AlternatorTechnologyModel>();
if (defaultValues)
ClearValues(viewModel);
OriginAlternatorTechnologies = new List<AlternatorTechnologyModel>();
SetXmlNamesToPropertyMapping();
}
......@@ -73,25 +75,22 @@ namespace VECTO3GUI.Model.TempDataObject
viewModel.HeatPump = HeatPump;
viewModel.AdjustableAuxiliaryHeater = AdjustableAuxiliaryHeater;
viewModel.SeparateAirDistributionDucts = SeparateAirDistributionDucts;
}
private void SetAlternatorTechnology(ObservableCollectionEx<AlternatorTechnologyModel> res)
{
if (OriginAlternatorTechnologies == null)
return;
//var res = new ObservableCollectionEx<AlternatorTechnologyModel>();
res.Clear();
for (int i = 0; i < OriginAlternatorTechnologies.Count; i++) {
res.Add(new AlternatorTechnologyModel{AlternatorTechnology = OriginAlternatorTechnologies[i].AlternatorTechnology});
}
//return res;
}
public void ClearValues(IAuxiliariesViewModel viewModel)
{
viewModel.AlternatorTechnologies.Clear(); // = default(ObservableCollectionEx<AlternatorTechnologyModel>);
viewModel.AlternatorTechnologies.Clear();
viewModel.DayrunninglightsLED = default(bool);
viewModel.HeadlightsLED = default(bool);
viewModel.PositionlightsLED = default(bool);
......@@ -124,7 +123,6 @@ namespace VECTO3GUI.Model.TempDataObject
HeatPump = auxiliaries.HeatPump;
AdjustableAuxiliaryHeater = auxiliaries.AdjustableAuxiliaryHeater;
SeparateAirDistributionDucts = auxiliaries.SeparateAirDistributionDucts;
}
private List<AlternatorTechnologyModel> GetOriginAlternatorTechnologies(IAuxiliariesViewModel auxiliaries)
......
......@@ -23,8 +23,19 @@ namespace VECTO3GUI.ViewModel.Impl
private ICommand _saveJobCommand;
private ICommand _closeJobCommand;
private ICommand _saveAsJobCommand;
private Component _selectedComponent;
public Component SelectedComponent
{
get { return _selectedComponent; }
set
{
if (SetProperty(ref _selectedComponent, value)) {
DoEditComponent(_selectedComponent);
}
}
}
protected string XmlFilePath { get; private set; }
protected bool IsNewJob { get; set; }
......@@ -87,6 +98,17 @@ namespace VECTO3GUI.ViewModel.Impl
protected virtual void DoEditComponent(Component component)
{
var nextView = GetComponentViewModel(component);
if (CurrentComponent is AuxiliariesViewModel) {
var convert = CurrentComponent as AuxiliariesViewModel;
convert?.CacheAlternatorTechnologies();
}
if (nextView is AuxiliariesViewModel) {
var convert = nextView as AuxiliariesViewModel;
convert.LoadCachedAlternatorTechnologies();
}
CurrentComponent = nextView ?? Kernel.Get<INoneViewModel>();
}
......
......@@ -148,7 +148,7 @@ namespace VECTO3GUI.ViewModel.Impl
get { return _appVersion; }
set
{
if (SetProperty(ref _appVersion, value))
if (!SetProperty(ref _appVersion, value))
return;
IsDataChanged(_appVersion, _componentData);
}
......@@ -162,9 +162,9 @@ namespace VECTO3GUI.ViewModel.Impl
get { return _noAirdragData; }
set
{
SetProperty(ref _noAirdragData, value);
if(!SetProperty(ref _noAirdragData, value))
return;
IsDataChanged(_noAirdragData, _componentData);
UseMeasurementData = !_noAirdragData;
}
}
......@@ -179,10 +179,15 @@ namespace VECTO3GUI.ViewModel.Impl
public bool UseMeasurementData
{
get { return _useMeasurementData; }
set { SetProperty(ref _useMeasurementData, value); }
set
{
if (!SetProperty(ref _useMeasurementData, value))
return;
IsDataChanged(_useMeasurementData, _componentData);
}
}
protected override void InputDataChanged()
{
var inputData = JobViewModel.InputDataProvider as IDeclarationInputDataProvider;
......@@ -191,30 +196,33 @@ namespace VECTO3GUI.ViewModel.Impl
_xmlFilePath = XmlHelper.GetXmlAbsoluteFilePath(xmlUri);
SetAirdragValues(_airdragData);
UseMeasurementData = _airdragData?.AirDragArea != null;
NoAirdragData = !UseMeasurementData;
IsEditable = false;
}
private void SetAirdragValues(IAirdragDeclarationInputData airdrag)
{
UseMeasuredValues = airdrag?.AirDragArea != null;
UseMeasurementData = _airdragData?.AirDragArea != null;
NoAirdragData = !UseMeasurementData;
if (airdrag?.AirDragArea == null)
{
_componentData = new AirdragComponentData(this, true);
return;
}
else
{
Model = airdrag.Model;
Manufacturer = airdrag.Manufacturer;
CertificationNumber = airdrag.CertificationNumber;
Date = airdrag.Date;
AppVersion = airdrag.AppVersion;
DeclaredCdxA = airdrag.AirDragArea;
DigestValue = airdrag.DigestValue;
ReadAdditionalAirdragValues();
_componentData = new AirdragComponentData(this);
}
Model = airdrag.Model;
Manufacturer = airdrag.Manufacturer;
CertificationNumber = airdrag.CertificationNumber;
Date = airdrag.Date;
AppVersion = airdrag.AppVersion;
DeclaredCdxA = airdrag.AirDragArea;
DigestValue = airdrag.DigestValue;
ReadAdditionalAirdragValues();
_componentData = new AirdragComponentData(this);
ClearChangedProperties();
}
......@@ -239,7 +247,8 @@ namespace VECTO3GUI.ViewModel.Impl
private void DoAirdragConfig(AirdragConfig config)
{
switch (config) {
switch (config)
{
case AirdragConfig.UseDefaultAirdragData:
NoAirdragData = true;
break;
......
......@@ -19,9 +19,6 @@ using VECTO3GUI.Model.TempDataObject;
namespace VECTO3GUI.ViewModel.Impl
{
public class AuxiliariesViewModel : AbstractComponentViewModel, IAuxiliariesViewModel
{
#region Members
......@@ -34,7 +31,7 @@ namespace VECTO3GUI.ViewModel.Impl
private IAxlesViewModel axlesViewModel;
private IBusAuxiliariesDeclarationData _busAuxiliaries;
private ObservableCollectionEx<AlternatorTechnologyModel> _alternatorTechnologies = new ObservableCollectionEx<AlternatorTechnologyModel>();
private bool _dayRunningLightsLED;
private bool _headlightyLED;
......@@ -288,15 +285,17 @@ namespace VECTO3GUI.ViewModel.Impl
public Dictionary<string, string> XmlNamesToPropertyMapping { get; private set; }
public ConsumerTechnology DoorDriveTechnology { get; set; }
public AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; private set; }
public AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; private set; }
public AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; private set; }
public AllowedEntry<string>[] AllowedAlternatorTechnology { get; private set; }
#endregion
private List<AlternatorTechnologyModel> _cachedAlternators { get; set; }
protected override void InputDataChanged()
{
......@@ -323,39 +322,41 @@ namespace VECTO3GUI.ViewModel.Impl
if (busAux == null)
{
_componentData = new AuxiliariesBusComponentData(this, true);
return;
AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged;
AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged;
}
if (!busAux.ElectricSupply.Alternators.IsNullOrEmpty())
else
{
if (!busAux.ElectricSupply.Alternators.IsNullOrEmpty())
{
AlternatorTechnologies.Clear();
AlternatorTechnologies.Clear(); // = new ObservableCollectionEx<AlternatorTechnologyModel>();
AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged;
AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged;
AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged;
AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged;
for (int i = 0; i < busAux.ElectricSupply.Alternators.Count; i++)
{
AlternatorTechnologies.Add(new AlternatorTechnologyModel(){ AlternatorTechnology = busAux.ElectricSupply.Alternators[i].Technology });
for (int i = 0; i < busAux.ElectricSupply.Alternators.Count; i++)
{
AlternatorTechnologies.Add(new AlternatorTechnologyModel() { AlternatorTechnology = busAux.ElectricSupply.Alternators[i].Technology });
}
}
DayrunninglightsLED = busAux.ElectricConsumers.DayrunninglightsLED;
HeadlightsLED = busAux.ElectricConsumers.HeadlightsLED;
PositionlightsLED = busAux.ElectricConsumers.PositionlightsLED;
BrakelightsLED = busAux.ElectricConsumers.BrakelightsLED;
InteriorLightsLED = busAux.ElectricConsumers.InteriorLightsLED;
SystemConfiguration = busAux.HVACAux.SystemConfiguration;
CompressorTypeDriver = busAux.HVACAux.CompressorTypeDriver;
CompressorTypePassenger = busAux.HVACAux.CompressorTypePassenger;
AuxHeaterPower = busAux.HVACAux.AuxHeaterPower;
DoubleGlasing = busAux.HVACAux.DoubleGlasing;
HeatPump = busAux.HVACAux.HeatPump;
AdjustableAuxiliaryHeater = busAux.HVACAux.AdjustableAuxiliaryHeater;
SeparateAirDistributionDucts = busAux.HVACAux.SeparateAirDistributionDucts;
_componentData = new AuxiliariesBusComponentData(this);
}
DayrunninglightsLED = busAux.ElectricConsumers.DayrunninglightsLED;
HeadlightsLED = busAux.ElectricConsumers.HeadlightsLED;
PositionlightsLED = busAux.ElectricConsumers.PositionlightsLED;
BrakelightsLED = busAux.ElectricConsumers.BrakelightsLED;
InteriorLightsLED = busAux.ElectricConsumers.InteriorLightsLED;
SystemConfiguration = busAux.HVACAux.SystemConfiguration;
CompressorTypeDriver = busAux.HVACAux.CompressorTypeDriver;
CompressorTypePassenger = busAux.HVACAux.CompressorTypePassenger;
AuxHeaterPower = busAux.HVACAux.AuxHeaterPower;
DoubleGlasing = busAux.HVACAux.DoubleGlasing;
HeatPump = busAux.HVACAux.HeatPump;
AdjustableAuxiliaryHeater = busAux.HVACAux.AdjustableAuxiliaryHeater;
SeparateAirDistributionDucts = busAux.HVACAux.SeparateAirDistributionDucts;
DoorDriveTechnology = ConsumerTechnology.Pneumatically;
_componentData = new AuxiliariesBusComponentData(this);
ClearChangedProperties();
}
......@@ -418,6 +419,31 @@ namespace VECTO3GUI.ViewModel.Impl
SetChangedProperty(changed, nameof(AlternatorTechnologies));
}
public void CacheAlternatorTechnologies()
{
if (_componentData != null)
{
_cachedAlternators = new List<AlternatorTechnologyModel>();
for (int i = 0; i < AlternatorTechnologies.Count; i++)
{
_cachedAlternators.Add(new AlternatorTechnologyModel { AlternatorTechnology = AlternatorTechnologies[i].AlternatorTechnology });
}
}
}
public void LoadCachedAlternatorTechnologies()
{
if (_componentData != null && _cachedAlternators != null)
{
AlternatorTechnologies.Clear();
for (int i = 0; i < _cachedAlternators.Count; i++)
{
AlternatorTechnologies.Add(new AlternatorTechnologyModel { AlternatorTechnology = _cachedAlternators[i].AlternatorTechnology });
}
}
}
public override object CommitComponentData()
{
_componentData.UpdateCurrentValues(this);
......@@ -448,7 +474,7 @@ namespace VECTO3GUI.ViewModel.Impl
RemovePropertyError(propertyName);
}
}
#region Commands
......@@ -492,15 +518,9 @@ namespace VECTO3GUI.ViewModel.Impl
private void DoAddAlternator()
{
if (AlternatorTechnologies == null) {
AlternatorTechnologies = new ObservableCollectionEx<AlternatorTechnologyModel>();
AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged;
AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged;
}
AlternatorTechnologies.Add(new AlternatorTechnologyModel
{
AlternatorTechnology = string.Empty
AlternatorTechnology = null
});
}
......
......@@ -116,8 +116,9 @@ namespace VECTO3GUI.ViewModel.Impl
if (XmlHelper.ValidateXDocument(xDoc, null, ValidationErrorAction)) {
_xmlCompletedBusWriter.WriteCompletedBusXml(XmlFilePath, xDoc);
CloseWindow(window);
} else {
ValidationResultDialogWindow(false);
}
ValidationResultDialogWindow(false);
}
}
......@@ -143,8 +144,9 @@ namespace VECTO3GUI.ViewModel.Impl
{
_xmlCompletedBusWriter.WriteCompletedBusXml(filePath, xDocument);
CloseWindow(window);
} else {
ValidationResultDialogWindow(false);
}
ValidationResultDialogWindow(false);
}
public ICommand CommitComponent
......
......@@ -234,7 +234,6 @@ namespace VECTO3GUI.ViewModel.Impl
{
if (!SetProperty(ref _doorDriveTechnology, value))
return;
IsDataChanged(_doorDriveTechnology, _componentData);
}
}
......@@ -267,30 +266,31 @@ namespace VECTO3GUI.ViewModel.Impl
if (vehicle == null)
{
_componentData = new VehicleBusComponentData(this, true);
return;
}
else
{
Manufacturer = vehicle.Manufacturer;
ManufacturerAddress = vehicle.ManufacturerAddress;
Model = vehicle.Model;
VIN = vehicle.VIN;
Date = vehicle.Date;
LegislativeClass = vehicle.LegislativeClass;
RegisteredClass = vehicle.RegisteredClass;
VehicleCode = vehicle.VehicleCode;
CurbMassChassis = vehicle.CurbMassChassis;
TechnicalPermissibleMaximumLadenMass = vehicle.GrossVehicleMassRating;
NgTankSystem = vehicle.TankSystem;
NumberOfPassengersLowerDeck = vehicle.NumberOfPassengersLowerDeck;
NumberOfPassengersUpperDeck = vehicle.NumberOfPassengersUpperDeck;
LowEntry = vehicle.FloorType == FloorType.LowFloor;
HeightIntegratedBody = vehicle.Height;
VehicleLength = vehicle.Length;
VehicleWidth = vehicle.Width;
EntranceHeight = vehicle.EntranceHeight;
DoorDriveTechnology = vehicle.DoorDriveTechnology;
_componentData = new VehicleBusComponentData(this);
}
Manufacturer = vehicle.Manufacturer;
ManufacturerAddress = vehicle.ManufacturerAddress;
Model = vehicle.Model;
VIN = vehicle.VIN;
Date = vehicle.Date;
LegislativeClass = vehicle.LegislativeClass;
RegisteredClass = vehicle.RegisteredClass;
VehicleCode = vehicle.VehicleCode;
CurbMassChassis = vehicle.CurbMassChassis;
TechnicalPermissibleMaximumLadenMass = vehicle.GrossVehicleMassRating;
NgTankSystem = vehicle.TankSystem;
NumberOfPassengersLowerDeck = vehicle.NumberOfPassengersLowerDeck;
NumberOfPassengersUpperDeck = vehicle.NumberOfPassengersUpperDeck;
LowEntry = vehicle.FloorType == FloorType.LowFloor;
HeightIntegratedBody = vehicle.Height;
VehicleLength = vehicle.Length;
VehicleWidth = vehicle.Width;
EntranceHeight = vehicle.EntranceHeight;
DoorDriveTechnology = vehicle.DoorDriveTechnology;
_componentData = new VehicleBusComponentData(this);
ClearChangedProperties();
}
......
......@@ -11,6 +11,7 @@ namespace VECTO3GUI.ViewModel.Interfaces
public interface IAirdrag : ICommonComponentParameters
{
bool NoAirdragData { get; set; }
bool UseMeasurementData { get; set; }
bool UseMeasuredValues { get; set; }
SquareMeter CdxA_0 { get; set; }
SquareMeter TransferredCdxA { get; set; }
......
......@@ -8,9 +8,6 @@ namespace VECTO3GUI.ViewModel.Interfaces
{
IAirdragDeclarationInputData ModelData { get; }
bool IsEditable { get; }
bool UseMeasurementData { get; }
ICommand LoadFileCommand { get; }
ICommand AirdragConfigCommand { get; }
......
......@@ -15,6 +15,7 @@ namespace VECTO3GUI.ViewModel.Interfaces
bool DeclarationMode { get; }
ObservableCollection<Component> Components { get; }
ICommand EditComponent { get; }
Component SelectedComponent { get; }
IComponentViewModel CurrentComponent { get; }
ICommand SaveJob { get; }
......
......@@ -62,16 +62,7 @@
<Grid Grid.Column="1">
<TabControl TabStripPlacement="Top" ItemsSource="{Binding Components}" x:Name="ComponentsTab" SelectedIndex="0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
Command="{Binding EditComponent}"
CommandParameter="{Binding ElementName=ComponentsTab, Path=SelectedItem}">
</i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
<TabControl TabStripPlacement="Top" ItemsSource="{Binding Components}" x:Name="ComponentsTab" SelectedIndex="0" SelectedItem="{Binding SelectedComponent}">
<TabControl.ItemTemplate>
<DataTemplate>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment