From 258fd8e2aa7c8722ba03b7d538db911171eaac40 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Thu, 2 Sep 2021 20:29:34 +0200 Subject: [PATCH] allow nullable parameters - required for APT Release Lockup Clutch --- .../InterimStageBusVehicleViewModel_v2_8.cs | 2 ++ .../Implementation/MultistageParameterViewModel.cs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs index ff7190924f..58f60ceea3 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/InterimStageBusVehicleViewModel_v2_8.cs @@ -318,6 +318,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation _parameterViewModels[nameof(PredictiveCruiseControlNullable)].EditingChangedCallback = ADASGroupEditingCallback; _parameterViewModels[nameof(ATEcoRollReleaseLockupClutch)].EditingChangedCallback = ADASGroupEditingCallback; + _parameterViewModels[nameof(ATEcoRollReleaseLockupClutch)].AllowNullValue = true; + Action<MultistageParameterViewModel> PassengerGroupEditingCallback = (MultistageParameterViewModel param) => { NumberOfPassengersEditingEnabled = param.EditingEnabled; }; diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageParameterViewModel.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageParameterViewModel.cs index 17248322fe..be128352b7 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageParameterViewModel.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageParameterViewModel.cs @@ -37,6 +37,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation private object _currentContent; private object _dummyContent; private bool _mandatory; + private bool _allowNullValue; private object _storedContent; private string _label; private ObservableCollection<Enum> _allowedItems; @@ -207,6 +208,16 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation } } + public bool AllowNullValue + { + get => _allowNullValue; + set + { + SetProperty(ref _allowNullValue, value); + UpdateValueFieldEditable(); + } + } + public bool EditingEnabled { get => _editingEnabled; @@ -398,7 +409,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation /// <returns></returns> public bool UpdateEditingEnabled() { - if (CurrentContent == null) { + if (!AllowNullValue && CurrentContent == null) { EditingEnabled = false; } else { EditingEnabled = true; -- GitLab