mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Display conditions - Events UI WIP
This commit is contained in:
1 parent
d115d41a80
commit
5b4188ed12
14 files changed
+591
-290
No files matched your search
@@ -1,73 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Modules;
|
||||
using Artemis.Core.Services;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.CustomViewModels
|
||||
{
|
||||
public class DataModelNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private readonly DataModelNode _node;
|
||||
private BindableCollection<Module> _modules;
|
||||
|
||||
public DataModelNodeCustomViewModel(DataModelNode node, ISettingsService settingsService) : base(node)
|
||||
{
|
||||
_node = node;
|
||||
|
||||
ShowFullPaths = settingsService.GetSetting("ProfileEditor.ShowFullPaths", true);
|
||||
ShowDataModelValues = settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false);
|
||||
}
|
||||
|
||||
public PluginSetting<bool> ShowFullPaths { get; }
|
||||
public PluginSetting<bool> ShowDataModelValues { get; }
|
||||
|
||||
public BindableCollection<Module> Modules
|
||||
{
|
||||
get => _modules;
|
||||
set => SetAndNotify(ref _modules, value);
|
||||
}
|
||||
|
||||
public DataModelPath DataModelPath
|
||||
{
|
||||
get => _node.DataModelPath;
|
||||
set
|
||||
{
|
||||
if (ReferenceEquals(_node.DataModelPath, value))
|
||||
return;
|
||||
|
||||
_node.DataModelPath?.Dispose();
|
||||
_node.DataModelPath = value;
|
||||
_node.DataModelPath.Save();
|
||||
|
||||
_node.Storage = _node.DataModelPath.Entity;
|
||||
_node.UpdateOutputPin(false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnActivate()
|
||||
{
|
||||
if (Modules != null)
|
||||
return;
|
||||
|
||||
Modules = new BindableCollection<Module>();
|
||||
if (_node.Script.Context is Profile scriptProfile && scriptProfile.Configuration.Module != null)
|
||||
Modules.Add(scriptProfile.Configuration.Module);
|
||||
else if (_node.Script.Context is ProfileConfiguration profileConfiguration && profileConfiguration.Module != null)
|
||||
Modules.Add(profileConfiguration.Module);
|
||||
|
||||
_node.PropertyChanged += NodeOnPropertyChanged;
|
||||
}
|
||||
|
||||
public override void OnDeactivate()
|
||||
{
|
||||
_node.PropertyChanged -= NodeOnPropertyChanged;
|
||||
}
|
||||
|
||||
private void NodeOnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(DataModelNode.DataModelPath))
|
||||
OnPropertyChanged(nameof(DataModelPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user