From e2cfac1437f512265e814372d950476d0af5f532 Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Wed, 8 Jul 2020 22:36:24 +0200 Subject: [PATCH] Display conditions - Show affix/prefix in static input --- .../Shared/DataModelPropertiesViewModel.cs | 4 +--- .../Shared/DataModelVisualizationViewModel.cs | 4 ++++ .../DisplayConditionPredicateView.xaml | 14 ++++++++++++-- .../GeneralDataModel.cs | 3 +++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs index b606ce2bc..fcd487c6d 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs @@ -22,9 +22,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared { return Parent.IsRootViewModel ? DataModel : base.GetCurrentValue(); } - - - + private void PopulateProperties(IDataModelVisualizationService dataModelVisualizationService) { if (Children.Any()) diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs index 49fa8cc49..53d93bbe5 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs @@ -180,6 +180,10 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared new DataModelPropertyAttribute {Name = PropertyInfo.Name.Humanize()}; else throw new ArtemisSharedUIException("Failed to get property description because plugin info is null but the parent has a datamodel"); + + // If a property description was provided but the name is null, use the humanized property name + if (PropertyDescription != null && PropertyDescription.Name == null && PropertyInfo != null) + PropertyDescription.Name = PropertyInfo.Name.Humanize(); } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/DisplayConditions/DisplayConditionPredicateView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/DisplayConditions/DisplayConditionPredicateView.xaml index 6ec5dcdc9..415886906 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/DisplayConditions/DisplayConditionPredicateView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/DisplayConditions/DisplayConditionPredicateView.xaml @@ -147,8 +147,18 @@ Command="{s:Action ActivateRightSideInputViewModel}" HorizontalAlignment="Left"> - + + + + + + diff --git a/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs b/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs index 03e286e1a..d18347777 100644 --- a/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs +++ b/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs @@ -40,6 +40,9 @@ namespace Artemis.Plugins.Modules.General [DataModelProperty(Name = "A test boolean", Description = "This is a test boolean that's not of any use outside testing!")] public bool TestBoolean { get; set; } + [DataModelProperty(Affix = "%", MinValue = 0, MaxValue = 100)] + public int Health { get; set; } + public SKPoint Position { get; set; } } } \ No newline at end of file