mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Data model visualization - Moved services and VMs to UI.Shared
Data model visualization - Added support for custom display VMs Data model visualization - Added framework for custom input VMs Shared UI - Made internal converters public
This commit is contained in:
1 parent
addb06c348
commit
448d94915c
30 files changed
+537
-129
No files matched your search
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.UI.Shared.Services;
|
||||
|
||||
namespace Artemis.UI.Shared.DataModelVisualization
|
||||
{
|
||||
public class DataModelVisualizationRegistration
|
||||
{
|
||||
private readonly IDataModelVisualizationService _dataModelVisualizationService;
|
||||
|
||||
public DataModelVisualizationRegistration(IDataModelVisualizationService dataModelVisualizationService,
|
||||
RegistrationType registrationType,
|
||||
PluginInfo pluginInfo,
|
||||
Type supportedType,
|
||||
Type viewModelType)
|
||||
{
|
||||
_dataModelVisualizationService = dataModelVisualizationService;
|
||||
RegistrationType = registrationType;
|
||||
PluginInfo = pluginInfo;
|
||||
SupportedType = supportedType;
|
||||
ViewModelType = viewModelType;
|
||||
|
||||
if (PluginInfo != Constants.CorePluginInfo)
|
||||
PluginInfo.Instance.PluginDisabled += InstanceOnPluginDisabled;
|
||||
}
|
||||
|
||||
public RegistrationType RegistrationType { get; }
|
||||
public PluginInfo PluginInfo { get; }
|
||||
public Type SupportedType { get; }
|
||||
public Type ViewModelType { get; }
|
||||
|
||||
internal void Unsubscribe()
|
||||
{
|
||||
if (PluginInfo != Constants.CorePluginInfo)
|
||||
PluginInfo.Instance.PluginDisabled -= InstanceOnPluginDisabled;
|
||||
}
|
||||
|
||||
private void InstanceOnPluginDisabled(object sender, EventArgs e)
|
||||
{
|
||||
if (RegistrationType == RegistrationType.Input)
|
||||
_dataModelVisualizationService.RemoveDataModelInput(this);
|
||||
else if (RegistrationType == RegistrationType.Display)
|
||||
_dataModelVisualizationService.RemoveDataModelDisplay(this);
|
||||
}
|
||||
}
|
||||
|
||||
public enum RegistrationType
|
||||
{
|
||||
Display,
|
||||
Input
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user