Profile editor - Moved layer property input to the Shared UI project

This commit is contained in:
SpoinkyNL committed 2020-06-02 22:23:09 +02:00
1 parent eda57f6d32
commit 92faafe1de
71 files changed
+1211 -434

No files matched your search

@@ -35,6 +35,7 @@
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\Artemis.UI.Shared\Artemis.UI.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="RGB.NET.Brushes">
@@ -0,0 +1,23 @@
<UserControl x:Class="Artemis.Plugins.LayerBrushes.ColorRgbNet.PropertyInput.StringPropertyInputView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:propertyInput="clr-namespace:Artemis.Plugins.LayerBrushes.ColorRgbNet.PropertyInput"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance propertyInput:StringPropertyInputViewModel}">
<StackPanel Orientation="Horizontal">
<!-- This is required because the main UI can't know where to show this -->
<TextBlock Width="10" Text="{Binding LayerProperty.PropertyDescription.InputPrefix}" />
<!-- Mess with the margins a bit to wrangle it into the tight bounds of the property tree -->
<TextBox Width="132"
Margin="0 -2.5 0 2.5"
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
Text="{Binding Path=InputValue}" />
<!-- This is required because the main UI can't know where to show this -->
<TextBlock Width="10" Text="{Binding LayerProperty.PropertyDescription.InputAffix}" />
</StackPanel>
</UserControl>
@@ -0,0 +1,14 @@
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Shared.PropertyInput;
using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.Plugins.LayerBrushes.ColorRgbNet.PropertyInput
{
public class StringPropertyInputViewModel : PropertyInputViewModel<string>
{
public StringPropertyInputViewModel(LayerProperty<string> layerProperty, IProfileEditorService profileEditorService) : base(layerProperty, profileEditorService)
{
// This is a fairly dumb input that can only take text and nothing else so it needs no special logic in its VM
}
}
}
@@ -1,4 +1,5 @@
using Artemis.Core.Extensions;
using System;
using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.LayerBrush;
using RGB.NET.Brushes;
@@ -1,4 +1,5 @@
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerProperties.Types;
using SkiaSharp;
@@ -10,9 +11,13 @@ namespace Artemis.Plugins.LayerBrushes.ColorRgbNet
[PropertyDescription(Description = "The color of the brush")]
public SKColorLayerProperty Color { get; set; }
[PropertyDescription(InputPrefix = "Test")]
public LayerProperty<string> TestProperty { get; set; }
protected override void PopulateDefaults()
{
Color.DefaultValue = new SKColor(255, 0, 0);
TestProperty.DefaultValue = "I was empty before!";
}
protected override void OnPropertiesInitialized()
@@ -1,24 +1,26 @@
using Artemis.Core.Plugins.LayerBrush;
using Artemis.Core.Plugins.Models;
using Artemis.Plugins.LayerBrushes.ColorRgbNet.PropertyInput;
using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.Plugins.LayerBrushes.ColorRgbNet
{
public class RgbNetColorBrushProvider : LayerBrushProvider
{
public RgbNetColorBrushProvider(PluginInfo pluginInfo) : base(pluginInfo)
private readonly IProfileEditorService _profileEditorService;
public RgbNetColorBrushProvider(PluginInfo pluginInfo, IProfileEditorService profileEditorService) : base(pluginInfo)
{
_profileEditorService = profileEditorService;
AddLayerBrushDescriptor<RgbNetColorBrush>("RGB.NET Color", "A RGB.NET based color", "Brush");
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
_profileEditorService.RegisterPropertyInput(PluginInfo, typeof(StringPropertyInputViewModel));
}
public override void DisablePlugin()
{
}
public override void Dispose()
protected override void DisablePlugin()
{
}
}