Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 36a3e65d authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

comboboxes: limit number of allowed values to useful set, xml writing: generate ID

parent 7386f7d5
No related branches found
No related tags found
No related merge requests found
Showing
with 102 additions and 106 deletions
...@@ -8,40 +8,40 @@ using VECTO3GUI.ViewModel.Impl; ...@@ -8,40 +8,40 @@ using VECTO3GUI.ViewModel.Impl;
namespace VECTO3GUI.Model namespace VECTO3GUI.Model
{ {
public enum AlternatorTechnology //public enum AlternatorTechnology
{ //{
Empty, // Empty,
Default // Default
} //}
public static class AlternatorTechnologyHelper //public static class AlternatorTechnologyHelper
{ //{
public static string GetLabel(this AlternatorTechnology technology) // public static string GetLabel(this AlternatorTechnology technology)
{ // {
switch (technology) { // switch (technology) {
case AlternatorTechnology.Default: // case AlternatorTechnology.Default:
return nameof(AlternatorTechnology.Default).ToLower(); // return nameof(AlternatorTechnology.Default).ToLower();
default: // default:
return string.Empty; // return string.Empty;
} // }
} // }
// public static AlternatorTechnology Parse(string technologyName)
// {
// switch (technologyName.ToLower()) {
// case "default":
// return AlternatorTechnology.Default;
// default:
// return AlternatorTechnology.Empty;
// }
// }
//}
public static AlternatorTechnology Parse(string technologyName)
{
switch (technologyName.ToLower()) {
case "default":
return AlternatorTechnology.Default;
default:
return AlternatorTechnology.Empty;
}
}
}
public class AlternatorTechnologyModel : ObservableObject public class AlternatorTechnologyModel : ObservableObject
{ {
public AlternatorTechnology _alternatorTechnology; public string _alternatorTechnology;
public AlternatorTechnology AlternatorTechnology public string AlternatorTechnology
{ {
get { return _alternatorTechnology; } get { return _alternatorTechnology; }
set { SetProperty(ref _alternatorTechnology, value); } set { SetProperty(ref _alternatorTechnology, value); }
......
...@@ -12,9 +12,12 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -12,9 +12,12 @@ namespace VECTO3GUI.Model.TempDataObject
{ {
public class AuxiliariesBusComponentData: IAuxiliariesBus, ITempDataObject<IAuxiliariesViewModel> public class AuxiliariesBusComponentData: IAuxiliariesBus, ITempDataObject<IAuxiliariesViewModel>
{ {
protected const int NotSelected = -1;
#region IAuxiliariesBus Interface #region IAuxiliariesBus Interface
public ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies { get; set; } public ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies { get; }
public List<AlternatorTechnologyModel> OriginAlternatorTechnologies { get; private set; } public List<AlternatorTechnologyModel> OriginAlternatorTechnologies { get; private set; }
public bool DayrunninglightsLED { get; set; } public bool DayrunninglightsLED { get; set; }
public bool HeadlightsLED { get; set; } public bool HeadlightsLED { get; set; }
...@@ -35,6 +38,7 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -35,6 +38,7 @@ namespace VECTO3GUI.Model.TempDataObject
public AuxiliariesBusComponentData(IAuxiliariesViewModel viewModel, bool defaultValues) public AuxiliariesBusComponentData(IAuxiliariesViewModel viewModel, bool defaultValues)
{ {
AlternatorTechnologies = new ObservableCollectionEx<AlternatorTechnologyModel>();
if (defaultValues) if (defaultValues)
ClearValues(viewModel); ClearValues(viewModel);
} }
...@@ -51,7 +55,7 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -51,7 +55,7 @@ namespace VECTO3GUI.Model.TempDataObject
public void ResetToComponentValues(IAuxiliariesViewModel viewModel) public void ResetToComponentValues(IAuxiliariesViewModel viewModel)
{ {
viewModel.AlternatorTechnologies = GetAlternatorTechnology(); SetAlternatorTechnology(viewModel.AlternatorTechnologies);
viewModel.DayrunninglightsLED = DayrunninglightsLED; viewModel.DayrunninglightsLED = DayrunninglightsLED;
viewModel.HeadlightsLED = HeadlightsLED; viewModel.HeadlightsLED = HeadlightsLED;
viewModel.PositionlightsLED = PositionlightsLED; viewModel.PositionlightsLED = PositionlightsLED;
...@@ -65,42 +69,42 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -65,42 +69,42 @@ namespace VECTO3GUI.Model.TempDataObject
viewModel.HeatPump = HeatPump; viewModel.HeatPump = HeatPump;
viewModel.AdjustableAuxiliaryHeater = AdjustableAuxiliaryHeater; viewModel.AdjustableAuxiliaryHeater = AdjustableAuxiliaryHeater;
viewModel.SeparateAirDistributionDucts = SeparateAirDistributionDucts; viewModel.SeparateAirDistributionDucts = SeparateAirDistributionDucts;
viewModel.DoorDriveTechnology = viewModel.DoorDriveTechnology;
} }
private ObservableCollectionEx<AlternatorTechnologyModel> GetAlternatorTechnology() private void SetAlternatorTechnology(ObservableCollectionEx<AlternatorTechnologyModel> res)
{ {
var res = new ObservableCollectionEx<AlternatorTechnologyModel>(); //var res = new ObservableCollectionEx<AlternatorTechnologyModel>();
res.Clear();
for (int i = 0; i < OriginAlternatorTechnologies.Count; i++) { for (int i = 0; i < OriginAlternatorTechnologies.Count; i++) {
res.Add(new AlternatorTechnologyModel{AlternatorTechnology = OriginAlternatorTechnologies[i].AlternatorTechnology}); res.Add(new AlternatorTechnologyModel{AlternatorTechnology = OriginAlternatorTechnologies[i].AlternatorTechnology});
} }
return res; //return res;
} }
public void ClearValues(IAuxiliariesViewModel viewModel) public void ClearValues(IAuxiliariesViewModel viewModel)
{ {
viewModel.AlternatorTechnologies = default(ObservableCollectionEx<AlternatorTechnologyModel>); viewModel.AlternatorTechnologies.Clear(); // = default(ObservableCollectionEx<AlternatorTechnologyModel>);
viewModel.DayrunninglightsLED = default(bool); viewModel.DayrunninglightsLED = default(bool);
viewModel.HeadlightsLED = default(bool); viewModel.HeadlightsLED = default(bool);
viewModel.PositionlightsLED = default(bool); viewModel.PositionlightsLED = default(bool);
viewModel.BrakelightsLED = default(bool); viewModel.BrakelightsLED = default(bool);
viewModel.InteriorLightsLED = default(bool); viewModel.InteriorLightsLED = default(bool);
viewModel.SystemConfiguration = default(BusHVACSystemConfiguration); viewModel.SystemConfiguration = (BusHVACSystemConfiguration)NotSelected;
viewModel.CompressorTypeDriver = default(ACCompressorType); viewModel.CompressorTypeDriver = (ACCompressorType)NotSelected;
viewModel.CompressorTypePassenger = default(ACCompressorType); viewModel.CompressorTypePassenger = (ACCompressorType)NotSelected;
viewModel.AuxHeaterPower = default(Watt); viewModel.AuxHeaterPower = default(Watt);
viewModel.DoubleGlasing = default(bool); viewModel.DoubleGlasing = default(bool);
viewModel.HeatPump = default(bool); viewModel.HeatPump = default(bool);
viewModel.AdjustableAuxiliaryHeater = default(bool); viewModel.AdjustableAuxiliaryHeater = default(bool);
viewModel.SeparateAirDistributionDucts = default(bool); viewModel.SeparateAirDistributionDucts = default(bool);
viewModel.DoorDriveTechnology = ConsumerTechnology.Pneumatically;
} }
private void SetValues(IAuxiliariesViewModel auxiliaries) private void SetValues(IAuxiliariesViewModel auxiliaries)
{ {
OriginAlternatorTechnologies = GetOriginAlternatorTechnologies(auxiliaries); OriginAlternatorTechnologies = GetOriginAlternatorTechnologies(auxiliaries);
AlternatorTechnologies = GetAlternatorTechnology(); SetAlternatorTechnology(AlternatorTechnologies);
DayrunninglightsLED = auxiliaries.DayrunninglightsLED; DayrunninglightsLED = auxiliaries.DayrunninglightsLED;
HeadlightsLED = auxiliaries.HeadlightsLED; HeadlightsLED = auxiliaries.HeadlightsLED;
PositionlightsLED = auxiliaries.PositionlightsLED; PositionlightsLED = auxiliaries.PositionlightsLED;
...@@ -114,7 +118,7 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -114,7 +118,7 @@ namespace VECTO3GUI.Model.TempDataObject
HeatPump = auxiliaries.HeatPump; HeatPump = auxiliaries.HeatPump;
AdjustableAuxiliaryHeater = auxiliaries.AdjustableAuxiliaryHeater; AdjustableAuxiliaryHeater = auxiliaries.AdjustableAuxiliaryHeater;
SeparateAirDistributionDucts = auxiliaries.SeparateAirDistributionDucts; SeparateAirDistributionDucts = auxiliaries.SeparateAirDistributionDucts;
DoorDriveTechnology = auxiliaries.DoorDriveTechnology;
} }
private List<AlternatorTechnologyModel> GetOriginAlternatorTechnologies(IAuxiliariesViewModel auxiliaries) private List<AlternatorTechnologyModel> GetOriginAlternatorTechnologies(IAuxiliariesViewModel auxiliaries)
......
...@@ -15,6 +15,8 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -15,6 +15,8 @@ namespace VECTO3GUI.Model.TempDataObject
{ {
public class VehicleBusComponentData : ICompleteVehicleBus, ITempDataObject<ICompleteVehicleBusViewModel> public class VehicleBusComponentData : ICompleteVehicleBus, ITempDataObject<ICompleteVehicleBusViewModel>
{ {
protected const int NotSelected = -1;
#region ICompleteVehicleBus Interface #region ICompleteVehicleBus Interface
public string Manufacturer { get; set; } public string Manufacturer { get; set; }
...@@ -85,12 +87,12 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -85,12 +87,12 @@ namespace VECTO3GUI.Model.TempDataObject
viewModel.Model = default(string); viewModel.Model = default(string);
viewModel.VIN = default(string); viewModel.VIN = default(string);
viewModel.Date = default(DateTime); viewModel.Date = default(DateTime);
viewModel.LegislativeClass = default(LegislativeClass); viewModel.LegislativeClass = (LegislativeClass)NotSelected;
viewModel.RegisteredClass = default(RegistrationClass); viewModel.RegisteredClass = (RegistrationClass)NotSelected;
viewModel.VehicleCode = default(VehicleCode); viewModel.VehicleCode = (VehicleCode)NotSelected;
viewModel.CurbMassChassis = default(Kilogram); viewModel.CurbMassChassis = default(Kilogram);
viewModel.TechnicalPermissibleMaximumLadenMass = default(Kilogram); viewModel.TechnicalPermissibleMaximumLadenMass = default(Kilogram);
viewModel.NgTankSystem = default(TankSystem); viewModel.NgTankSystem = (TankSystem)NotSelected;
viewModel.NumberOfPassengersLowerDeck = default(int); viewModel.NumberOfPassengersLowerDeck = default(int);
viewModel.NumberOfPassengersUpperDeck = default(int); viewModel.NumberOfPassengersUpperDeck = default(int);
viewModel.LowEntry = LowEntry; viewModel.LowEntry = LowEntry;
...@@ -98,7 +100,7 @@ namespace VECTO3GUI.Model.TempDataObject ...@@ -98,7 +100,7 @@ namespace VECTO3GUI.Model.TempDataObject
viewModel.VehicleLength = default(Meter); viewModel.VehicleLength = default(Meter);
viewModel.VehicleWidth = default(Meter); viewModel.VehicleWidth = default(Meter);
viewModel.EntranceHeight = default(Meter); viewModel.EntranceHeight = default(Meter);
viewModel.DoorDriveTechnology = default(ConsumerTechnology); viewModel.DoorDriveTechnology = (ConsumerTechnology)NotSelected;
} }
......
...@@ -76,9 +76,9 @@ namespace VECTO3GUI.Util.XML ...@@ -76,9 +76,9 @@ namespace VECTO3GUI.Util.XML
var vehicleData = (ICompleteVehicleBus)inputData[Component.CompleteBusVehicle]; var vehicleData = (ICompleteVehicleBus)inputData[Component.CompleteBusVehicle];
var id = "CB-" + Guid.NewGuid().ToString("n").Substring(0, 20);
return new XElement(_v20 + XMLNames.Component_Vehicle, return new XElement(_v20 + XMLNames.Component_Vehicle,
new XAttribute(XMLNames.Component_ID_Attr, vehicleData.VIN), new XAttribute(XMLNames.Component_ID_Attr, id),
new XAttribute(_xsi + "type", XMLDeclarationCompletedBusDataProviderV26.XSD_TYPE),// "CompletedVehicleDeclarationType" new XAttribute(_xsi + "type", XMLDeclarationCompletedBusDataProviderV26.XSD_TYPE),// "CompletedVehicleDeclarationType"
new XAttribute("xmlns", _v26), new XAttribute("xmlns", _v26),
...@@ -176,10 +176,6 @@ namespace VECTO3GUI.Util.XML ...@@ -176,10 +176,6 @@ namespace VECTO3GUI.Util.XML
new XElement(_v26 + XMLNames.Bus_Positionlights, auxBus?.PositionlightsLED), new XElement(_v26 + XMLNames.Bus_Positionlights, auxBus?.PositionlightsLED),
new XElement(_v26 + XMLNames.Bus_Brakelights, auxBus?.BrakelightsLED), new XElement(_v26 + XMLNames.Bus_Brakelights, auxBus?.BrakelightsLED),
new XElement(_v26 + XMLNames.Bus_Interiorlights, auxBus?.InteriorLightsLED))), new XElement(_v26 + XMLNames.Bus_Interiorlights, auxBus?.InteriorLightsLED))),
//----> ToDo remove if xsd gets changed <---
new XElement(_v26 + XMLNames.BusAux_PneumaticSystem,
new XElement(_v26 + XMLNames.BusAux_PneumaticSystem_DoorDriveTechnology, auxBus?.DoorDriveTechnology.GetLabel().ToLower())),
//------------------------------------------
new XElement(_v26 + "HVAC", new XElement(_v26 + "HVAC",
new XElement(_v26 + XMLNames.Bus_SystemConfiguration, auxBus?.SystemConfiguration.GetXmlFormat()), new XElement(_v26 + XMLNames.Bus_SystemConfiguration, auxBus?.SystemConfiguration.GetXmlFormat()),
new XElement(_v26 + XMLNames.Bus_CompressorType, new XElement(_v26 + XMLNames.Bus_CompressorType,
...@@ -204,11 +200,11 @@ namespace VECTO3GUI.Util.XML ...@@ -204,11 +200,11 @@ namespace VECTO3GUI.Util.XML
for (int i = 0; i < alternatorTechnologies.Count; i++) { for (int i = 0; i < alternatorTechnologies.Count; i++) {
if(alternatorTechnologies[i].AlternatorTechnology == AlternatorTechnology.Empty) if(string.IsNullOrWhiteSpace(alternatorTechnologies[i].AlternatorTechnology))
continue; continue;
result.Add(new XElement(_v26 + XMLNames.BusAux_ElectricSystem_AlternatorTechnology, result.Add(new XElement(_v26 + XMLNames.BusAux_ElectricSystem_AlternatorTechnology,
alternatorTechnologies[i].AlternatorTechnology.GetLabel())); alternatorTechnologies[i].AlternatorTechnology));
} }
return result.Count > 0 ? result.ToArray() : null; return result.Count > 0 ? result.ToArray() : null;
......
...@@ -18,7 +18,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -18,7 +18,7 @@ namespace VECTO3GUI.ViewModel.Impl
{ {
public enum AirdragConfig public enum AirdragConfig
{ {
WithoutAirdrag, UseDefaultAirdragData,
UseMeasurementData, UseMeasurementData,
Unknown Unknown
} }
...@@ -29,10 +29,10 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -29,10 +29,10 @@ namespace VECTO3GUI.ViewModel.Impl
{ {
switch (airdrag) switch (airdrag)
{ {
case AirdragConfig.WithoutAirdrag: case AirdragConfig.UseDefaultAirdragData:
return "Without Airdrag"; return "Use default airdrag data";
case AirdragConfig.UseMeasurementData: case AirdragConfig.UseMeasurementData:
return "Use Measurement Data"; return "Use airdrag component data";
} }
return string.Empty; return string.Empty;
} }
...@@ -41,9 +41,9 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -41,9 +41,9 @@ namespace VECTO3GUI.ViewModel.Impl
{ {
switch (name) switch (name)
{ {
case "Without Airdrag": case "Use default airdrag data":
return AirdragConfig.WithoutAirdrag; return AirdragConfig.UseDefaultAirdragData;
case "Use Measurement Data": case "Use airdrag component data":
return AirdragConfig.UseMeasurementData; return AirdragConfig.UseMeasurementData;
} }
return AirdragConfig.Unknown; return AirdragConfig.Unknown;
...@@ -191,15 +191,15 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -191,15 +191,15 @@ namespace VECTO3GUI.ViewModel.Impl
_xmlFilePath = XmlHelper.GetXmlAbsoluteFilePath(xmlUri); _xmlFilePath = XmlHelper.GetXmlAbsoluteFilePath(xmlUri);
SetAirdragValues(_airdragData); SetAirdragValues(_airdragData);
UseMeasurementData = _airdragData.AirDragArea != null; UseMeasurementData = _airdragData?.AirDragArea != null;
NoAirdragData = !UseMeasurementData; NoAirdragData = !UseMeasurementData;
IsEditable = false; IsEditable = false;
} }
private void SetAirdragValues(IAirdragDeclarationInputData airdrag) private void SetAirdragValues(IAirdragDeclarationInputData airdrag)
{ {
UseMeasuredValues = airdrag.AirDragArea != null; UseMeasuredValues = airdrag?.AirDragArea != null;
if (airdrag.AirDragArea == null) if (airdrag?.AirDragArea == null)
{ {
_componentData = new AirdragComponentData(this, true); _componentData = new AirdragComponentData(this, true);
return; return;
...@@ -240,7 +240,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -240,7 +240,7 @@ namespace VECTO3GUI.ViewModel.Impl
private void DoAirdragConfig(AirdragConfig config) private void DoAirdragConfig(AirdragConfig config)
{ {
switch (config) { switch (config) {
case AirdragConfig.WithoutAirdrag: case AirdragConfig.UseDefaultAirdragData:
NoAirdragData = true; NoAirdragData = true;
break; break;
case AirdragConfig.UseMeasurementData: case AirdragConfig.UseMeasurementData:
......
...@@ -35,7 +35,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -35,7 +35,7 @@ namespace VECTO3GUI.ViewModel.Impl
private IBusAuxiliariesDeclarationData _busAuxiliaries; private IBusAuxiliariesDeclarationData _busAuxiliaries;
private ObservableCollectionEx<AlternatorTechnologyModel> _alternatorTechnologies; private ObservableCollectionEx<AlternatorTechnologyModel> _alternatorTechnologies = new ObservableCollectionEx<AlternatorTechnologyModel>();
private bool _dayRunningLightsLED; private bool _dayRunningLightsLED;
private bool _headlightyLED; private bool _headlightyLED;
private bool _positionlightsLED; private bool _positionlightsLED;
...@@ -139,7 +139,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -139,7 +139,7 @@ namespace VECTO3GUI.ViewModel.Impl
public ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies public ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies
{ {
get { return _alternatorTechnologies; } get { return _alternatorTechnologies; }
set { SetProperty(ref _alternatorTechnologies, value); } //set { SetProperty(ref _alternatorTechnologies, value); }
} }
public bool DayrunninglightsLED public bool DayrunninglightsLED
...@@ -292,7 +292,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -292,7 +292,7 @@ namespace VECTO3GUI.ViewModel.Impl
public AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; private set; } public AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; private set; }
public AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; private set; } public AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; private set; }
public AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; private set; } public AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; private set; }
public AllowedEntry<AlternatorTechnology>[] AllowedAlternatorTechnology { get; private set; } public AllowedEntry<string>[] AllowedAlternatorTechnology { get; private set; }
#endregion #endregion
...@@ -325,17 +325,14 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -325,17 +325,14 @@ namespace VECTO3GUI.ViewModel.Impl
if (!busAux.ElectricSupply.Alternators.IsNullOrEmpty()) if (!busAux.ElectricSupply.Alternators.IsNullOrEmpty())
{ {
AlternatorTechnologies = new ObservableCollectionEx<AlternatorTechnologyModel>(); AlternatorTechnologies.Clear(); // = new ObservableCollectionEx<AlternatorTechnologyModel>();
AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged; AlternatorTechnologies.CollectionChanged += AlternatorTechnologiesOnCollectionChanged;
AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged; AlternatorTechnologies.CollectionItemChanged += AlternatorTechnologiesOnCollectionItemChanged;
for (int i = 0; i < busAux.ElectricSupply.Alternators.Count; i++) for (int i = 0; i < busAux.ElectricSupply.Alternators.Count; i++)
{ {
AlternatorTechnologies.Add(new AlternatorTechnologyModel AlternatorTechnologies.Add(new AlternatorTechnologyModel(){ AlternatorTechnology = busAux.ElectricSupply.Alternators[i].Technology });
{
AlternatorTechnology = AlternatorTechnologyHelper.Parse(busAux.ElectricSupply.Alternators[i].Technology)
});
} }
} }
...@@ -393,16 +390,18 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -393,16 +390,18 @@ namespace VECTO3GUI.ViewModel.Impl
private void SetAllowedValues() private void SetAllowedValues()
{ {
AllowedSystemConfigurations = Enum.GetValues(typeof(BusHVACSystemConfiguration)).Cast<BusHVACSystemConfiguration>() AllowedSystemConfigurations = EnumHelper.GetValues<BusHVACSystemConfiguration>()
.Where(x => x != BusHVACSystemConfiguration.Unknown)
.Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray(); .Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray();
AllowedDriverACCompressorTypes = Enum.GetValues(typeof(ACCompressorType)).Cast<ACCompressorType>() AllowedDriverACCompressorTypes = EnumHelper.GetValues<ACCompressorType>()
.Where(x => x != ACCompressorType.Unknown)
.Select(acc => AllowedEntry.Create(acc, acc.GetLabel())).ToArray(); .Select(acc => AllowedEntry.Create(acc, acc.GetLabel())).ToArray();
AllowedPassengerACCompressorTypes = AllowedDriverACCompressorTypes; AllowedPassengerACCompressorTypes = AllowedDriverACCompressorTypes;
AllowedAlternatorTechnology = Enum.GetValues(typeof(AlternatorTechnology)).Cast<AlternatorTechnology>() AllowedAlternatorTechnology = DeclarationData.BusAuxiliaries.AlternatorTechnologies.Entries.Keys
.Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray(); .Select(x => AllowedEntry.Create(x, x)).ToArray();
} }
public override void ResetComponentData() public override void ResetComponentData()
...@@ -434,7 +433,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -434,7 +433,7 @@ namespace VECTO3GUI.ViewModel.Impl
} }
private void DoRemoveAlternator(int index) private void DoRemoveAlternator(int index)
{ {
AlternatorTechnologies?.RemoveAt(index); AlternatorTechnologies.RemoveAt(index);
} }
...@@ -449,7 +448,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -449,7 +448,7 @@ namespace VECTO3GUI.ViewModel.Impl
private void DoRemoveAllAlternators() private void DoRemoveAllAlternators()
{ {
AlternatorTechnologies?.Clear(); AlternatorTechnologies.Clear();
OnPropertyChanged(nameof(AlternatorTechnologies)); OnPropertyChanged(nameof(AlternatorTechnologies));
} }
...@@ -466,7 +465,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -466,7 +465,7 @@ namespace VECTO3GUI.ViewModel.Impl
{ {
AlternatorTechnologies.Add(new AlternatorTechnologyModel AlternatorTechnologies.Add(new AlternatorTechnologyModel
{ {
AlternatorTechnology = AlternatorTechnology.Empty AlternatorTechnology = string.Empty
}); });
} }
......
...@@ -245,7 +245,7 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -245,7 +245,7 @@ namespace VECTO3GUI.ViewModel.Impl
public AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses { get; private set; } public AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses { get; private set; }
public AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; private set; } public AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; private set; }
public AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; private set; } public AllowedEntry<ConsumerTechnology>[] AllowedDoorDriveTechnologies { get; private set; }
public AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; private set; } public AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; private set; }
public AllowedEntry<TankSystem?>[] AllowedTankSystems { get; private set; } public AllowedEntry<TankSystem?>[] AllowedTankSystems { get; private set; }
...@@ -297,28 +297,20 @@ namespace VECTO3GUI.ViewModel.Impl ...@@ -297,28 +297,20 @@ namespace VECTO3GUI.ViewModel.Impl
private void SetAllowedEntries() private void SetAllowedEntries()
{ {
AllowedLegislativeClasses = Enum.GetValues(typeof(LegislativeClass)).Cast<LegislativeClass>() AllowedLegislativeClasses = new [] {LegislativeClass.M3}
.Select(lc => AllowedEntry.Create(lc, lc.GetLabel())).ToArray(); .Select(lc => AllowedEntry.Create(lc, lc.GetLabel())).ToArray();
AllowedVehicleCodes = Enum.GetValues(typeof(VehicleCode)).Cast<VehicleCode>() AllowedVehicleCodes = EnumHelper.GetValues<VehicleCode>().Where(x => x != VehicleCode.NOT_APPLICABLE)
.Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray(); .Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray();
AllowedConsumerTechnologies = Enum.GetValues(typeof(ConsumerTechnology)).Cast<ConsumerTechnology>() AllowedDoorDriveTechnologies = new [] {ConsumerTechnology.Pneumatically, ConsumerTechnology.Electrically}
.Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray(); .Select(sc => AllowedEntry.Create(sc, sc.GetLabel())).ToArray();
AllowedRegisteredClasses = Enum.GetValues(typeof(RegistrationClass)).Cast<RegistrationClass>() AllowedRegisteredClasses = EnumHelper.GetValues<RegistrationClass>().Where(x => x != RegistrationClass.unknown)
.Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray(); .Select(vc => AllowedEntry.Create(vc, vc.GetLabel())).ToArray();
var tankSystems = Enum.GetValues(typeof(TankSystem)).Cast<TankSystem>().ToArray(); AllowedTankSystems = new[] { AllowedEntry.Create((TankSystem?)null, "Not applicable") }
var tank = new AllowedEntry<TankSystem?> [tankSystems.Length+1]; .Concat(EnumHelper.GetValues<TankSystem>().Select(x => AllowedEntry.Create((TankSystem?)x, x.ToString()))).ToArray();
tank[0] = AllowedEntry.Create((TankSystem?)null, null);
for (int i = 1; i < tankSystems.Length + 1; i++) {
tank[i] = AllowedEntry.Create<TankSystem?>(tankSystems[i-1], tankSystems[i-1].ToString());
}
AllowedTankSystems = tank;
} }
#endregion #endregion
......
...@@ -15,7 +15,7 @@ namespace VECTO3GUI.ViewModel.Interfaces ...@@ -15,7 +15,7 @@ namespace VECTO3GUI.ViewModel.Interfaces
{ {
#region Electric System #region Electric System
ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies { get; set; } ObservableCollectionEx<AlternatorTechnologyModel> AlternatorTechnologies { get; /*set; */ }
bool DayrunninglightsLED { get; set; } bool DayrunninglightsLED { get; set; }
bool HeadlightsLED { get; set; } bool HeadlightsLED { get; set; }
bool PositionlightsLED { get; set; } bool PositionlightsLED { get; set; }
...@@ -36,7 +36,7 @@ namespace VECTO3GUI.ViewModel.Interfaces ...@@ -36,7 +36,7 @@ namespace VECTO3GUI.ViewModel.Interfaces
bool SeparateAirDistributionDucts { get; set; } bool SeparateAirDistributionDucts { get; set; }
#endregion #endregion
ConsumerTechnology DoorDriveTechnology { get; set; }
} }
} }
...@@ -42,7 +42,7 @@ namespace VECTO3GUI.ViewModel.Interfaces { ...@@ -42,7 +42,7 @@ namespace VECTO3GUI.ViewModel.Interfaces {
AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; } AllowedEntry<BusHVACSystemConfiguration>[] AllowedSystemConfigurations { get; }
AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; } AllowedEntry<ACCompressorType>[] AllowedDriverACCompressorTypes { get; }
AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; } AllowedEntry<ACCompressorType>[] AllowedPassengerACCompressorTypes { get; }
AllowedEntry<AlternatorTechnology>[] AllowedAlternatorTechnology { get; } AllowedEntry<string>[] AllowedAlternatorTechnology { get; }
#endregion #endregion
} }
......
...@@ -11,7 +11,7 @@ namespace VECTO3GUI.ViewModel.Interfaces ...@@ -11,7 +11,7 @@ namespace VECTO3GUI.ViewModel.Interfaces
{ {
AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses { get; } AllowedEntry<LegislativeClass>[] AllowedLegislativeClasses { get; }
AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; } AllowedEntry<VehicleCode>[] AllowedVehicleCodes { get; }
AllowedEntry<ConsumerTechnology>[] AllowedConsumerTechnologies { get; } AllowedEntry<ConsumerTechnology>[] AllowedDoorDriveTechnologies { get; }
AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; } AllowedEntry<RegistrationClass>[] AllowedRegisteredClasses { get; }
AllowedEntry<TankSystem?>[] AllowedTankSystems { get; } AllowedEntry<TankSystem?>[] AllowedTankSystems { get; }
} }
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<RadioButton GroupName="AirdragConfig" Margin="5" <RadioButton GroupName="AirdragConfig" Margin="5"
Content="{Binding Source={x:Static impl:AirdragConfig.WithoutAirdrag}, Converter={converter:EnumConverter}}" Content="{Binding Source={x:Static impl:AirdragConfig.UseDefaultAirdragData}, Converter={converter:EnumConverter}}"
Command="{Binding AirdragConfigCommand}" CommandParameter="{Binding Source={x:Static impl:AirdragConfig.WithoutAirdrag}}" Command="{Binding AirdragConfigCommand}" CommandParameter="{Binding Source={x:Static impl:AirdragConfig.UseDefaultAirdragData}}"
IsChecked="{Binding NoAirdragData}"/> IsChecked="{Binding NoAirdragData}"/>
<RadioButton GroupName="AirdragConfig" Margin="5" <RadioButton GroupName="AirdragConfig" Margin="5"
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
AllowedValues="{Binding AllowedPassengerACCompressorTypes}" /> AllowedValues="{Binding AllowedPassengerACCompressorTypes}" />
<customControls:VectoParameterControl <customControls:VectoParameterControl
Caption="Height Integrated Body" Unit="{helper:SIUnit AuxHeaterPower}" CaptionWidthGroup="lblWidth" UnitWidthGroup="unitWidth" Caption="Aux Heater Power" Unit="{helper:SIUnit AuxHeaterPower}" CaptionWidthGroup="lblWidth" UnitWidthGroup="unitWidth"
Value="{Binding AuxHeaterPower, Converter={converter:SIValueConverter}, ConverterParameter=double}" /> Value="{Binding AuxHeaterPower, Converter={converter:SIValueConverter}, ConverterParameter=double}" />
<customControls:CheckboxParameter <customControls:CheckboxParameter
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
Caption="Door Drive Technology" Caption="Door Drive Technology"
CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth" CaptionWidthGroup="vehicleLbl" UnitWidthGroup="unitWidth"
Value="{Binding DoorDriveTechnology}" Value="{Binding DoorDriveTechnology}"
AllowedValues="{Binding AllowedConsumerTechnologies}" /> AllowedValues="{Binding AllowedDoorDriveTechnologies}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
......
...@@ -24,7 +24,10 @@ ...@@ -24,7 +24,10 @@
ItemsSource="{Binding AllowedValues}" ItemsSource="{Binding AllowedValues}"
SelectedValue="{Binding Value}" SelectedValue="{Binding Value}"
SelectedValuePath="Value" SelectedValuePath="Value"
DisplayMemberPath="Label"/> DisplayMemberPath="Label"
IsEditable="True"
IsReadOnly="True"
Text="Select..."/>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Unit}" Margin="5,0,5,0"/> <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Unit}" Margin="5,0,5,0"/>
</Grid> </Grid>
</UserControl> </UserControl>
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