mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile editor - Moved layer property input to the Shared UI project
This commit is contained in:
1 parent
a5b66441d9
commit
f1cbfb36e9
71 files changed
+1211
-434
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
|
||||
namespace Artemis.UI.Shared.PropertyInput
|
||||
{
|
||||
public class PropertyInputRegistration
|
||||
{
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
|
||||
internal PropertyInputRegistration(IProfileEditorService profileEditorService, PluginInfo pluginInfo, Type supportedType, Type viewModelType)
|
||||
{
|
||||
_profileEditorService = profileEditorService;
|
||||
PluginInfo = pluginInfo;
|
||||
SupportedType = supportedType;
|
||||
ViewModelType = viewModelType;
|
||||
|
||||
if (PluginInfo != Constants.CorePluginInfo)
|
||||
PluginInfo.Instance.PluginDisabled += InstanceOnPluginDisabled;
|
||||
}
|
||||
|
||||
public PluginInfo PluginInfo { get; }
|
||||
public Type SupportedType { get; }
|
||||
public Type ViewModelType { get; }
|
||||
|
||||
internal void Unsubscribe()
|
||||
{
|
||||
if (PluginInfo != Constants.CorePluginInfo)
|
||||
PluginInfo.Instance.PluginDisabled -= InstanceOnPluginDisabled;
|
||||
}
|
||||
|
||||
internal void Remove()
|
||||
{
|
||||
// It'll call Unsubscribe for us
|
||||
_profileEditorService.RemovePropertyInput(this);
|
||||
}
|
||||
|
||||
private void InstanceOnPluginDisabled(object sender, EventArgs e)
|
||||
{
|
||||
Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user