mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Ironed out LayerEditor conditions design
This commit is contained in:
parent
9c32bb6ce6
commit
c2cfadf942
@ -8,6 +8,7 @@ using System.Security.Principal;
|
||||
using System.Windows;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using static System.String;
|
||||
|
||||
namespace Artemis.Utilities
|
||||
{
|
||||
@ -63,9 +64,18 @@ namespace Artemis.Utilities
|
||||
var list = new List<PropertyCollection>();
|
||||
foreach (var propertyInfo in getProperties)
|
||||
{
|
||||
var friendlyName = Empty;
|
||||
if (propertyInfo.PropertyType.Name == "Int32")
|
||||
friendlyName = "(Number) ";
|
||||
else if (propertyInfo.PropertyType.Name == "String")
|
||||
friendlyName = "(Text) ";
|
||||
if (propertyInfo.PropertyType.BaseType?.Name == "Enum")
|
||||
friendlyName = "(Choice) ";
|
||||
|
||||
var parent = new PropertyCollection
|
||||
{
|
||||
Type = propertyInfo.PropertyType.Name,
|
||||
DisplayType = friendlyName,
|
||||
Display = $"{path.Replace(".", " → ")}{propertyInfo.Name}",
|
||||
Path = $"{path}{propertyInfo.Name}"
|
||||
};
|
||||
@ -76,7 +86,9 @@ namespace Artemis.Utilities
|
||||
parent.Type = "Enum";
|
||||
}
|
||||
|
||||
list.Add(parent);
|
||||
if (friendlyName != Empty)
|
||||
list.Add(parent);
|
||||
|
||||
list.AddRange(GenerateTypeMap(propertyInfo.PropertyType.GetProperties(), path + $"{propertyInfo.Name}."));
|
||||
}
|
||||
return list;
|
||||
@ -94,6 +106,7 @@ namespace Artemis.Utilities
|
||||
public string[] EnumValues { get; set; }
|
||||
|
||||
public List<PropertyCollection> Children { get; set; }
|
||||
public string DisplayType { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,35 +6,57 @@
|
||||
xmlns:local="clr-namespace:Artemis.Views.LayerEditor"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:utilities="clr-namespace:Artemis.Utilities"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="132.061" d:DesignWidth="632.296">
|
||||
mc:Ignorable="d" d:DesignWidth="613.296" Height="46">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Resources/Icons.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="30" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- Left -->
|
||||
<ComboBox x:Name="DataModelProps" Grid.Column="0" Width="250" MaxDropDownHeight="125"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top" DisplayMemberPath="Display" />
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel DataContext="{Binding}" Orientation="Horizontal">
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Path=DisplayType}"/>
|
||||
<TextBlock Text="{Binding Path=Display}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- Center -->
|
||||
<TextBlock Grid.Column="1" Text="is" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,3,0,0" />
|
||||
<ComboBox x:Name="Operators" Grid.Column="2" Width="150" MaxDropDownHeight="125" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top" Margin="0,0,20,0" />
|
||||
VerticalAlignment="Top" />
|
||||
|
||||
<!-- Right -->
|
||||
<Grid Grid.Column="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" x:Name="UserValueIsVisible">
|
||||
<TextBox x:Name="UserValue" VerticalAlignment="Top" />
|
||||
<Grid Grid.Column="3" HorizontalAlignment="Left" Margin="10,0,0,0" Width="152">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" x:Name="UserValueIsVisible" HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||
<TextBox x:Name="UserValue" VerticalAlignment="Center" HorizontalAlignment="Left" Width="115"/>
|
||||
</StackPanel>
|
||||
<Button Grid.Row="1" x:Name="Delete" Content="Delete condition" VerticalAlignment="Bottom" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" HorizontalAlignment="Right" />
|
||||
<Button Grid.Column="1" x:Name="Delete" Width="26" Height="26" Style="{DynamicResource SquareButtonStyle}" VerticalAlignment="Top" HorizontalAlignment="Right" >
|
||||
<Button.Content>
|
||||
<Rectangle Fill="Black" Width="12" Height="12">
|
||||
<Rectangle.OpacityMask>
|
||||
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
|
||||
</Rectangle.OpacityMask>
|
||||
</Rectangle>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user