Plugin settings window - Updated design

Brushes - Added option for brushes to have a settings window
Effects - Added option for effects to have a settings window
This commit is contained in:
Robert committed 2020-07-07 15:02:15 +02:00
1 parent f944a675f1
commit 35c4ead456
20 files changed
+403 -23

No files matched your search

@@ -0,0 +1,15 @@
using Artemis.Core.Plugins.LayerBrush.Abstract;
using Stylet;
namespace Artemis.Core.Plugins.Abstract.ViewModels
{
public abstract class BrushConfigurationViewModel : Screen
{
protected BrushConfigurationViewModel(BaseLayerBrush layerBrush)
{
LayerBrush = layerBrush;
}
public BaseLayerBrush LayerBrush { get; }
}
}
@@ -0,0 +1,15 @@
using Artemis.Core.Plugins.LayerEffect.Abstract;
using Stylet;
namespace Artemis.Core.Plugins.Abstract.ViewModels
{
public abstract class EffectConfigurationViewModel : Screen
{
protected EffectConfigurationViewModel(BaseLayerEffect layerEffect)
{
LayerEffect = layerEffect;
}
public BaseLayerEffect LayerEffect { get; }
}
}
@@ -9,6 +9,6 @@ namespace Artemis.Core.Plugins.Abstract.ViewModels
Plugin = plugin;
}
public Plugin Plugin { get; set; }
public Plugin Plugin { get; }
}
}
@@ -1,5 +1,6 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.Abstract.ViewModels;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces;
@@ -70,6 +71,12 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
}
}
/// <summary>
/// Gets or sets whether this plugin has a configuration view model.
/// If set to true, <see cref="GetConfigurationViewModel" /> will be called when the plugin is configured from the UI.
/// </summary>
public bool HasConfigurationViewModel { get; protected set; }
public void Dispose()
{
DisableLayerBrush();
@@ -94,6 +101,16 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
/// <param name="deltaTime"></param>
public abstract void Update(double deltaTime);
/// <summary>
/// Called when the brush configuration window is opened from the UI. The UI will only attempt to open if
/// <see cref="HasConfigurationViewModel" /> is set to True.
/// </summary>
/// <returns></returns>
public virtual BrushConfigurationViewModel GetConfigurationViewModel()
{
return null;
}
// Not only is this needed to initialize properties on the layer brushes, it also prevents implementing anything
// but LayerBrush<T> and RgbNetLayerBrush<T> outside the core
internal abstract void Initialize(ILayerService layerService);
@@ -1,5 +1,6 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.Abstract.ViewModels;
using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces;
using SkiaSharp;
@@ -96,6 +97,12 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
internal string PropertyRootPath => $"LayerEffect.{EntityId}.{GetType().Name}.";
/// <summary>
/// Gets or sets whether this plugin has a configuration view model.
/// If set to true, <see cref="GetConfigurationViewModel" /> will be called when the plugin is configured from the UI.
/// </summary>
public bool HasConfigurationViewModel { get; protected set; }
public void Dispose()
{
DisableLayerEffect();
@@ -138,5 +145,16 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
// Not only is this needed to initialize properties on the layer effects, it also prevents implementing anything
// but LayerEffect<T> outside the core
internal abstract void Initialize(ILayerService layerService);
/// <summary>
/// Called when the effect configuration window is opened from the UI. The UI will only attempt to open if
/// <see cref="HasConfigurationViewModel" /> is set to True.
/// </summary>
/// <returns></returns>
public virtual EffectConfigurationViewModel GetConfigurationViewModel()
{
return null;
}
}
}