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

This commit is contained in:
SpoinkyNL committed 2020-06-02 15:58:19 +02:00
1 parent a5b66441d9
commit f1cbfb36e9
71 files changed
+1211 -434

No files matched your search

@@ -16,7 +16,7 @@ namespace Artemis.Plugins.Devices.Asus
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(AsusRGBDevice<>), sender, args);
_rgbService.AddDeviceProvider(RgbDeviceProvider);
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.CoolerMaster
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(CoolerMasterRGBDevice<>), sender, args);
RGB.NET.Devices.CoolerMaster.CoolerMasterDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "CMSDK.dll"));
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.Corsair
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(CorsairRGBDevice<>), sender, args);
RGB.NET.Devices.Corsair.CorsairDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "CUESDK.x64_2017.dll"));
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.DMX
HasConfigurationViewModel = true;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
// TODO: Load from configuration
// RGB.NET.Devices.DMX.DMXDeviceProvider.Instance.AddDeviceDefinition();
@@ -25,7 +25,7 @@ namespace Artemis.Plugins.Devices.Logitech
_logger = logger;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(LogitechRGBDevice<>), sender, args);
RGB.NET.Devices.Logitech.LogitechDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "LogitechLedEnginesWrapper.dll"));
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.Msi
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(MsiRGBDevice<>), sender, args);
RGB.NET.Devices.Msi.MsiDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "MysticLight_SDK.dll"));
@@ -16,7 +16,7 @@ namespace Artemis.Plugins.Devices.Novation
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(NovationRGBDevice<>), sender, args);
_rgbService.AddDeviceProvider(RgbDeviceProvider);
@@ -18,7 +18,7 @@ namespace Artemis.Plugins.Devices.Razer
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(RazerRGBDevice<>), sender, args);
RGB.NET.Devices.Razer.RazerDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "RzChromaSDK.dll"));
@@ -15,7 +15,7 @@ namespace Artemis.Plugins.Devices.Roccat
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
// TODO: Find out why this is missing, Roccat seems unimplemented
// PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(RoccatRGBDevice<>), sender, args);
@@ -16,7 +16,7 @@ namespace Artemis.Plugins.Devices.SteelSeries
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
// TODO Check to see if this works, it's usually a generic type after all
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(SteelSeriesRGBDevice), sender, args);
@@ -25,7 +25,7 @@ namespace Artemis.Plugins.Devices.WS281X
public PluginSettings Settings { get; }
public override void EnablePlugin()
protected override void EnablePlugin()
{
var definitions = Settings.GetSetting<List<DeviceDefinition>>("DeviceDefinitions");
if (definitions.Value == null)
@@ -49,18 +49,11 @@ namespace Artemis.Plugins.Devices.WS281X
_rgbService.AddDeviceProvider(RgbDeviceProvider);
}
public override void DisablePlugin()
protected override void DisablePlugin()
{
// TODO: Remove the device provider from the surface
}
public override void Dispose()
{
// TODO: This will probably not go well without first removing the device provider
// WS281XDeviceProvider.Instance.ResetDevices();
// WS281XDeviceProvider.Instance.Dispose();
}
public override PluginConfigurationViewModel GetConfigurationViewModel()
{
return new WS281XConfigurationViewModel(this, Settings);
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.Wooting
_rgbService = rgbService;
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(WootingRGBDevice<>), sender, args);
RGB.NET.Devices.Wooting.WootingDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "wooting-rgb-sdk64.dll"));
@@ -25,16 +25,9 @@ namespace Artemis.Plugins.Devices.Wooting
_rgbService.AddDeviceProvider(RgbDeviceProvider);
}
public override void DisablePlugin()
protected override void DisablePlugin()
{
// TODO: Remove the device provider from the surface
}
public override void Dispose()
{
// TODO: This will probably not go well without first removing the device provider
// WootingDeviceProvider.Instance.ResetDevices();
// WootingDeviceProvider.Instance.Dispose();
}
}
}
@@ -10,15 +10,11 @@ namespace Artemis.Plugins.LayerBrushes.Color
AddLayerBrushDescriptor<ColorBrush>("Color", "A color with an (optional) gradient", "Brush");
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
}
public override void DisablePlugin()
{
}
public override void Dispose()
protected override void DisablePlugin()
{
}
}
@@ -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()
{
}
}
@@ -10,15 +10,11 @@ namespace Artemis.Plugins.LayerBrushes.Noise
AddLayerBrushDescriptor<NoiseBrush>("Noise", "A brush of that shows an animated random noise", "ScatterPlot");
}
public override void EnablePlugin()
protected override void EnablePlugin()
{
}
public override void DisablePlugin()
{
}
public override void Dispose()
protected override void DisablePlugin()
{
}
}
@@ -22,20 +22,16 @@ namespace Artemis.Plugins.Modules.General
var testSetting = _settings.GetSetting("TestSetting", DateTime.Now);
}
public override void EnablePlugin()
{
}
public override void DisablePlugin()
{
}
public override IEnumerable<ModuleViewModel> GetViewModels()
{
return new List<ModuleViewModel> {new GeneralViewModel(this)};
}
public override void Dispose()
protected override void EnablePlugin()
{
}
protected override void DisablePlugin()
{
}
}