1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Display conditions - Show affix/prefix in static input

This commit is contained in:
SpoinkyNL 2020-07-08 22:36:24 +02:00
parent 92dfbb354a
commit e2cfac1437
4 changed files with 20 additions and 5 deletions

View File

@ -22,9 +22,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
{
return Parent.IsRootViewModel ? DataModel : base.GetCurrentValue();
}
private void PopulateProperties(IDataModelVisualizationService dataModelVisualizationService)
{
if (Children.Any())

View File

@ -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();
}
}
}

View File

@ -147,8 +147,18 @@
Command="{s:Action ActivateRightSideInputViewModel}"
HorizontalAlignment="Left">
<Grid>
<TextBlock Text="{Binding DisplayConditionPredicate.RightStaticValue}"
Visibility="{Binding DisplayConditionPredicate.RightStaticValue, Converter={StaticResource NullToVisibilityConverter}}" />
<StackPanel Visibility="{Binding DisplayConditionPredicate.RightStaticValue, Converter={StaticResource NullToVisibilityConverter}}" Orientation="Horizontal">
<TextBlock Margin="0 0 3 0"
FontWeight="Light"
Text="{Binding SelectedLeftSideProperty.PropertyDescription.Prefix}"
Visibility="{Binding SelectedLeftSideProperty.PropertyDescription.Prefix, Converter={StaticResource NullToVisibilityConverter}}"/>
<TextBlock Text="{Binding DisplayConditionPredicate.RightStaticValue}"/>
<TextBlock Margin="3 0 0 0"
FontWeight="Light"
Text="{Binding SelectedLeftSideProperty.PropertyDescription.Affix}"
Visibility="{Binding SelectedLeftSideProperty.PropertyDescription.Affix, Converter={StaticResource NullToVisibilityConverter}}" />
</StackPanel>
<TextBlock Text="« Enter a value »"
FontStyle="Italic"
Visibility="{Binding DisplayConditionPredicate.RightStaticValue, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}" />

View File

@ -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; }
}
}