mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Nodes - Added type color registration system
Nodes - Generate (stable) type colors for undefined types
This commit is contained in:
parent
5675d1895b
commit
b8077ca589
@ -16,7 +16,7 @@ namespace Artemis.Core
|
|||||||
/// <returns>The RGB.NET color</returns>
|
/// <returns>The RGB.NET color</returns>
|
||||||
public static Color ToRgbColor(this SKColor color)
|
public static Color ToRgbColor(this SKColor color)
|
||||||
{
|
{
|
||||||
return new(color.Alpha, color.Red, color.Green, color.Blue);
|
return new Color(color.Alpha, color.Red, color.Green, color.Blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -49,7 +49,7 @@ namespace Artemis.Core
|
|||||||
/// <returns>The sum of the two colors</returns>
|
/// <returns>The sum of the two colors</returns>
|
||||||
public static SKColor Sum(this SKColor a, SKColor b)
|
public static SKColor Sum(this SKColor a, SKColor b)
|
||||||
{
|
{
|
||||||
return new(
|
return new SKColor(
|
||||||
ClampToByte(a.Red + b.Red),
|
ClampToByte(a.Red + b.Red),
|
||||||
ClampToByte(a.Green + b.Green),
|
ClampToByte(a.Green + b.Green),
|
||||||
ClampToByte(a.Blue + b.Blue),
|
ClampToByte(a.Blue + b.Blue),
|
||||||
@ -57,6 +57,19 @@ namespace Artemis.Core
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Darkens the color by the specified amount
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="c">The color to darken</param>
|
||||||
|
/// <param name="amount">The brightness of the new color</param>
|
||||||
|
/// <returns>The darkened color</returns>
|
||||||
|
public static SKColor Darken(this SKColor c, float amount)
|
||||||
|
{
|
||||||
|
c.ToHsl(out float h, out float s, out float l);
|
||||||
|
l *= 1f - amount;
|
||||||
|
return SKColor.FromHsl(h, s, l);
|
||||||
|
}
|
||||||
|
|
||||||
private static byte ClampToByte(float value)
|
private static byte ClampToByte(float value)
|
||||||
{
|
{
|
||||||
return (byte) Math.Clamp(value, 0, 255);
|
return (byte) Math.Clamp(value, 0, 255);
|
||||||
|
|||||||
@ -4,24 +4,19 @@ using System.Reflection;
|
|||||||
using Artemis.Storage.Entities.Profile.Nodes;
|
using Artemis.Storage.Entities.Profile.Nodes;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
using Ninject.Parameters;
|
using Ninject.Parameters;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Core.Services
|
namespace Artemis.Core.Services
|
||||||
{
|
{
|
||||||
internal class NodeService : INodeService
|
internal class NodeService : INodeService
|
||||||
{
|
{
|
||||||
private readonly IKernel _kernel;
|
|
||||||
|
|
||||||
#region Constants
|
#region Constants
|
||||||
|
|
||||||
private static readonly Type TYPE_NODE = typeof(INode);
|
private static readonly Type TYPE_NODE = typeof(INode);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties & Fields
|
private readonly IKernel _kernel;
|
||||||
|
|
||||||
public IEnumerable<NodeData> AvailableNodes => NodeTypeStore.GetAll();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
@ -32,8 +27,20 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
|
public IEnumerable<NodeData> AvailableNodes => NodeTypeStore.GetAll();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public TypeColorRegistration? GetTypeColor(Type type)
|
||||||
|
{
|
||||||
|
return NodeTypeStore.GetColor(type);
|
||||||
|
}
|
||||||
|
|
||||||
public NodeTypeRegistration RegisterNodeType(Plugin plugin, Type nodeType)
|
public NodeTypeRegistration RegisterNodeType(Plugin plugin, Type nodeType)
|
||||||
{
|
{
|
||||||
if (plugin == null) throw new ArgumentNullException(nameof(plugin));
|
if (plugin == null) throw new ArgumentNullException(nameof(plugin));
|
||||||
@ -46,10 +53,18 @@ namespace Artemis.Core.Services
|
|||||||
string description = nodeAttribute?.Description ?? string.Empty;
|
string description = nodeAttribute?.Description ?? string.Empty;
|
||||||
string category = nodeAttribute?.Category ?? string.Empty;
|
string category = nodeAttribute?.Category ?? string.Empty;
|
||||||
|
|
||||||
NodeData nodeData = new(plugin, nodeType, name, description, category, (e) => CreateNode(e, nodeType));
|
NodeData nodeData = new(plugin, nodeType, name, description, category, e => CreateNode(e, nodeType));
|
||||||
return NodeTypeStore.Add(nodeData);
|
return NodeTypeStore.Add(nodeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TypeColorRegistration RegisterTypeColor(Plugin plugin, Type type, SKColor color)
|
||||||
|
{
|
||||||
|
if (plugin == null) throw new ArgumentNullException(nameof(plugin));
|
||||||
|
if (type == null) throw new ArgumentNullException(nameof(type));
|
||||||
|
|
||||||
|
return NodeTypeStore.AddColor(type, color, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
private INode CreateNode(NodeEntity? entity, Type nodeType)
|
private INode CreateNode(NodeEntity? entity, Type nodeType)
|
||||||
{
|
{
|
||||||
INode node = _kernel.Get(nodeType) as INode ?? throw new InvalidOperationException($"Node {nodeType} is not an INode");
|
INode node = _kernel.Get(nodeType) as INode ?? throw new InvalidOperationException($"Node {nodeType} is not an INode");
|
||||||
@ -72,20 +87,33 @@ namespace Artemis.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A service that provides access to the node system
|
/// A service that provides access to the node system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface INodeService : IArtemisService
|
public interface INodeService : IArtemisService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all available nodes
|
/// Gets all available nodes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IEnumerable<NodeData> AvailableNodes { get; }
|
IEnumerable<NodeData> AvailableNodes { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a node of the provided <paramref name="nodeType"/>
|
/// Gets the best matching registration for the provided type
|
||||||
|
/// </summary>
|
||||||
|
TypeColorRegistration? GetTypeColor(Type type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a node of the provided <paramref name="nodeType" />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plugin">The plugin the node belongs to</param>
|
/// <param name="plugin">The plugin the node belongs to</param>
|
||||||
/// <param name="nodeType">The type of node to initialize</param>
|
/// <param name="nodeType">The type of node to initialize</param>
|
||||||
NodeTypeRegistration RegisterNodeType(Plugin plugin, Type nodeType);
|
NodeTypeRegistration RegisterNodeType(Plugin plugin, Type nodeType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a type with a provided color for use in the node editor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plugin">The plugin making the registration</param>
|
||||||
|
/// <param name="type">The type to associate the color with</param>
|
||||||
|
/// <param name="color">The color to display</param>
|
||||||
|
TypeColorRegistration RegisterTypeColor(Plugin plugin, Type type, SKColor color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Core
|
namespace Artemis.Core
|
||||||
{
|
{
|
||||||
internal class NodeTypeStore
|
internal class NodeTypeStore
|
||||||
{
|
{
|
||||||
private static readonly List<NodeTypeRegistration> Registrations = new();
|
private static readonly List<NodeTypeRegistration> Registrations = new();
|
||||||
|
private static readonly List<TypeColorRegistration> ColorRegistrations = new();
|
||||||
|
|
||||||
public static NodeTypeRegistration Add(NodeData nodeData)
|
public static NodeTypeRegistration Add(NodeData nodeData)
|
||||||
{
|
{
|
||||||
@ -19,7 +21,7 @@ namespace Artemis.Core
|
|||||||
if (Registrations.Any(r => r.NodeData == nodeData))
|
if (Registrations.Any(r => r.NodeData == nodeData))
|
||||||
throw new ArtemisCoreException($"Data binding modifier type store already contains modifier '{nodeData.Name}'");
|
throw new ArtemisCoreException($"Data binding modifier type store already contains modifier '{nodeData.Name}'");
|
||||||
|
|
||||||
typeRegistration = new NodeTypeRegistration(nodeData, nodeData.Plugin) { IsInStore = true };
|
typeRegistration = new NodeTypeRegistration(nodeData, nodeData.Plugin) {IsInStore = true};
|
||||||
Registrations.Add(typeRegistration);
|
Registrations.Add(typeRegistration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +34,7 @@ namespace Artemis.Core
|
|||||||
lock (Registrations)
|
lock (Registrations)
|
||||||
{
|
{
|
||||||
if (!Registrations.Contains(typeRegistration))
|
if (!Registrations.Contains(typeRegistration))
|
||||||
throw new ArtemisCoreException($"Data binding modifier type store does not contain modifier type '{typeRegistration.NodeData.Name}'");
|
throw new ArtemisCoreException($"Node type store does not contain modifier type '{typeRegistration.NodeData.Name}'");
|
||||||
|
|
||||||
Registrations.Remove(typeRegistration);
|
Registrations.Remove(typeRegistration);
|
||||||
typeRegistration.IsInStore = false;
|
typeRegistration.IsInStore = false;
|
||||||
@ -57,6 +59,51 @@ namespace Artemis.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Plugin? GetPlugin(INode node)
|
||||||
|
{
|
||||||
|
lock (Registrations)
|
||||||
|
{
|
||||||
|
return Registrations.FirstOrDefault(r => r.Plugin.GetType().Assembly == node.GetType().Assembly)?.Plugin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TypeColorRegistration AddColor(Type type, SKColor color, Plugin plugin)
|
||||||
|
{
|
||||||
|
TypeColorRegistration typeColorRegistration;
|
||||||
|
lock (ColorRegistrations)
|
||||||
|
{
|
||||||
|
if (ColorRegistrations.Any(r => r.Type == type))
|
||||||
|
throw new ArtemisCoreException($"Node color store already contains a color for '{type.Name}'");
|
||||||
|
|
||||||
|
typeColorRegistration = new TypeColorRegistration(type, color, plugin) {IsInStore = true};
|
||||||
|
ColorRegistrations.Add(typeColorRegistration);
|
||||||
|
}
|
||||||
|
|
||||||
|
return typeColorRegistration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveColor(TypeColorRegistration typeColorRegistration)
|
||||||
|
{
|
||||||
|
lock (ColorRegistrations)
|
||||||
|
{
|
||||||
|
if (!ColorRegistrations.Contains(typeColorRegistration))
|
||||||
|
throw new ArtemisCoreException($"Node color store does not contain modifier type '{typeColorRegistration.Type.Name}'");
|
||||||
|
|
||||||
|
ColorRegistrations.Remove(typeColorRegistration);
|
||||||
|
typeColorRegistration.IsInStore = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TypeColorRegistration? GetColor(Type type)
|
||||||
|
{
|
||||||
|
lock (ColorRegistrations)
|
||||||
|
{
|
||||||
|
return ColorRegistrations
|
||||||
|
.OrderByDescending(r => r.Type.ScoreCastability(type))
|
||||||
|
.FirstOrDefault(r => r.Type.ScoreCastability(type) > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
public static event EventHandler<NodeTypeStoreEvent>? NodeTypeAdded;
|
public static event EventHandler<NodeTypeStoreEvent>? NodeTypeAdded;
|
||||||
@ -73,13 +120,5 @@ namespace Artemis.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static Plugin? GetPlugin(INode node)
|
|
||||||
{
|
|
||||||
lock (Registrations)
|
|
||||||
{
|
|
||||||
return Registrations.FirstOrDefault(r => r.Plugin.GetType().Assembly == node.GetType().Assembly)?.Plugin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,9 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Core
|
namespace Artemis.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a registration for a type of <see cref="INode"/>
|
/// Represents a registration for a type of <see cref="INode" />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class NodeTypeRegistration
|
public class NodeTypeRegistration
|
||||||
{
|
{
|
||||||
@ -15,13 +16,16 @@ namespace Artemis.Core
|
|||||||
Plugin.Disabled += OnDisabled;
|
Plugin.Disabled += OnDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the node data that was registered
|
||||||
|
/// </summary>
|
||||||
public NodeData NodeData { get; }
|
public NodeData NodeData { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plugin the node is associated with
|
/// Gets the plugin the node is associated with
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Plugin Plugin { get; }
|
public Plugin Plugin { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a boolean indicating whether the registration is in the internal Core store
|
/// Gets a boolean indicating whether the registration is in the internal Core store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -34,4 +38,51 @@ namespace Artemis.Core
|
|||||||
NodeTypeStore.Remove(this);
|
NodeTypeStore.Remove(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a registration for a <see cref="SKColor" /> to associate with a certain <see cref="System.Type" />
|
||||||
|
/// </summary>
|
||||||
|
public class TypeColorRegistration
|
||||||
|
{
|
||||||
|
internal TypeColorRegistration(Type type, SKColor color, Plugin plugin)
|
||||||
|
{
|
||||||
|
Type = type;
|
||||||
|
Color = color;
|
||||||
|
Plugin = plugin;
|
||||||
|
|
||||||
|
Plugin.Disabled += OnDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type
|
||||||
|
/// </summary>
|
||||||
|
public Type Type { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the color
|
||||||
|
/// </summary>
|
||||||
|
public SKColor Color { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a darkened tone of the <see cref="Color" />
|
||||||
|
/// </summary>
|
||||||
|
public SKColor DarkenedColor => Color.Darken(0.35f);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the plugin type color is associated with
|
||||||
|
/// </summary>
|
||||||
|
public Plugin Plugin { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a boolean indicating whether the registration is in the internal Core store
|
||||||
|
/// </summary>
|
||||||
|
public bool IsInStore { get; internal set; }
|
||||||
|
|
||||||
|
private void OnDisabled(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Plugin.Disabled -= OnDisabled;
|
||||||
|
if (IsInStore)
|
||||||
|
NodeTypeStore.RemoveColor(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -20,10 +20,10 @@ namespace Artemis.UI.Shared.Services
|
|||||||
{
|
{
|
||||||
private readonly IKernel _kernel;
|
private readonly IKernel _kernel;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
private readonly IModuleService _moduleService;
|
||||||
private readonly IProfileService _profileService;
|
private readonly IProfileService _profileService;
|
||||||
private readonly List<PropertyInputRegistration> _registeredPropertyEditors;
|
private readonly List<PropertyInputRegistration> _registeredPropertyEditors;
|
||||||
private readonly IRgbService _rgbService;
|
private readonly IRgbService _rgbService;
|
||||||
private readonly IModuleService _moduleService;
|
|
||||||
private readonly object _selectedProfileElementLock = new();
|
private readonly object _selectedProfileElementLock = new();
|
||||||
private readonly object _selectedProfileLock = new();
|
private readonly object _selectedProfileLock = new();
|
||||||
private TimeSpan _currentTime;
|
private TimeSpan _currentTime;
|
||||||
@ -31,7 +31,8 @@ namespace Artemis.UI.Shared.Services
|
|||||||
private int _pixelsPerSecond;
|
private int _pixelsPerSecond;
|
||||||
private bool _suspendEditing;
|
private bool _suspendEditing;
|
||||||
|
|
||||||
public ProfileEditorService(IKernel kernel, ILogger logger, IProfileService profileService, ICoreService coreService, IRgbService rgbService, IModuleService moduleService)
|
public ProfileEditorService(IKernel kernel, ILogger logger, ICoreService coreService, IProfileService profileService, IRgbService rgbService, IModuleService moduleService,
|
||||||
|
INodeService nodeService)
|
||||||
{
|
{
|
||||||
_kernel = kernel;
|
_kernel = kernel;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -40,9 +41,56 @@ namespace Artemis.UI.Shared.Services
|
|||||||
_moduleService = moduleService;
|
_moduleService = moduleService;
|
||||||
_registeredPropertyEditors = new List<PropertyInputRegistration>();
|
_registeredPropertyEditors = new List<PropertyInputRegistration>();
|
||||||
coreService.FrameRendered += CoreServiceOnFrameRendered;
|
coreService.FrameRendered += CoreServiceOnFrameRendered;
|
||||||
|
|
||||||
|
TypeUtilities.NodeService = nodeService;
|
||||||
PixelsPerSecond = 100;
|
PixelsPerSecond = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void OnSelectedProfileChanged(ProfileConfigurationEventArgs e)
|
||||||
|
{
|
||||||
|
SelectedProfileChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnSelectedProfileUpdated(ProfileConfigurationEventArgs e)
|
||||||
|
{
|
||||||
|
SelectedProfileSaved?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnSelectedProfileElementChanged(RenderProfileElementEventArgs e)
|
||||||
|
{
|
||||||
|
SelectedProfileElementChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnSelectedProfileElementUpdated(RenderProfileElementEventArgs e)
|
||||||
|
{
|
||||||
|
SelectedProfileElementSaved?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnCurrentTimeChanged()
|
||||||
|
{
|
||||||
|
CurrentTimeChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnPixelsPerSecondChanged()
|
||||||
|
{
|
||||||
|
PixelsPerSecondChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnSuspendEditingChanged()
|
||||||
|
{
|
||||||
|
SuspendEditingChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnProfilePreviewUpdated()
|
||||||
|
{
|
||||||
|
ProfilePreviewUpdated?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnSelectedDataBindingChanged()
|
||||||
|
{
|
||||||
|
SelectedDataBindingChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
private void CoreServiceOnFrameRendered(object? sender, FrameRenderedEventArgs e)
|
private void CoreServiceOnFrameRendered(object? sender, FrameRenderedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_doTick) return;
|
if (!_doTick) return;
|
||||||
@ -89,7 +137,9 @@ namespace Artemis.UI.Shared.Services
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (renderElement.Suspended)
|
if (renderElement.Suspended)
|
||||||
|
{
|
||||||
renderElement.Disable();
|
renderElement.Disable();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderElement.Enable();
|
renderElement.Enable();
|
||||||
@ -104,7 +154,6 @@ namespace Artemis.UI.Shared.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ReadOnlyCollection<PropertyInputRegistration> RegisteredPropertyEditors => _registeredPropertyEditors.AsReadOnly();
|
public ReadOnlyCollection<PropertyInputRegistration> RegisteredPropertyEditors => _registeredPropertyEditors.AsReadOnly();
|
||||||
|
|
||||||
public bool Playing { get; set; }
|
public bool Playing { get; set; }
|
||||||
|
|
||||||
public bool SuspendEditing
|
public bool SuspendEditing
|
||||||
@ -183,10 +232,10 @@ namespace Artemis.UI.Shared.Services
|
|||||||
// No need to deactivate the profile, if needed it will be deactivated next update
|
// No need to deactivate the profile, if needed it will be deactivated next update
|
||||||
if (SelectedProfileConfiguration != null)
|
if (SelectedProfileConfiguration != null)
|
||||||
SelectedProfileConfiguration.IsBeingEdited = false;
|
SelectedProfileConfiguration.IsBeingEdited = false;
|
||||||
|
|
||||||
PreviousSelectedProfileConfiguration = SelectedProfileConfiguration;
|
PreviousSelectedProfileConfiguration = SelectedProfileConfiguration;
|
||||||
SelectedProfileConfiguration = profileConfiguration;
|
SelectedProfileConfiguration = profileConfiguration;
|
||||||
|
|
||||||
// The new profile may need activation
|
// The new profile may need activation
|
||||||
if (SelectedProfileConfiguration != null)
|
if (SelectedProfileConfiguration != null)
|
||||||
{
|
{
|
||||||
@ -319,10 +368,8 @@ namespace Artemis.UI.Shared.Services
|
|||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
if (existing.Plugin != plugin)
|
if (existing.Plugin != plugin)
|
||||||
{
|
|
||||||
throw new ArtemisSharedUIException($"Cannot register property editor for type {supportedType.Name} because an editor was already " +
|
throw new ArtemisSharedUIException($"Cannot register property editor for type {supportedType.Name} because an editor was already " +
|
||||||
$"registered by {existing.Plugin}");
|
$"registered by {existing.Plugin}");
|
||||||
}
|
|
||||||
|
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
@ -367,10 +414,8 @@ namespace Artemis.UI.Shared.Services
|
|||||||
|
|
||||||
if (snapToCurrentTime)
|
if (snapToCurrentTime)
|
||||||
// Snap to the current time
|
// Snap to the current time
|
||||||
{
|
|
||||||
if (Math.Abs(time.TotalMilliseconds - CurrentTime.TotalMilliseconds) < tolerance.TotalMilliseconds)
|
if (Math.Abs(time.TotalMilliseconds - CurrentTime.TotalMilliseconds) < tolerance.TotalMilliseconds)
|
||||||
return CurrentTime;
|
return CurrentTime;
|
||||||
}
|
|
||||||
|
|
||||||
if (snapTimes != null)
|
if (snapTimes != null)
|
||||||
{
|
{
|
||||||
@ -406,9 +451,13 @@ namespace Artemis.UI.Shared.Services
|
|||||||
viewModelType = registration.ViewModelType.MakeGenericType(layerProperty.GetType().GenericTypeArguments);
|
viewModelType = registration.ViewModelType.MakeGenericType(layerProperty.GetType().GenericTypeArguments);
|
||||||
}
|
}
|
||||||
else if (registration != null)
|
else if (registration != null)
|
||||||
|
{
|
||||||
viewModelType = registration.ViewModelType;
|
viewModelType = registration.ViewModelType;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (viewModelType == null)
|
if (viewModelType == null)
|
||||||
return null;
|
return null;
|
||||||
@ -428,6 +477,16 @@ namespace Artemis.UI.Shared.Services
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event EventHandler<ProfileConfigurationEventArgs>? SelectedProfileChanged;
|
||||||
|
public event EventHandler<ProfileConfigurationEventArgs>? SelectedProfileSaved;
|
||||||
|
public event EventHandler<RenderProfileElementEventArgs>? SelectedProfileElementChanged;
|
||||||
|
public event EventHandler<RenderProfileElementEventArgs>? SelectedProfileElementSaved;
|
||||||
|
public event EventHandler? SelectedDataBindingChanged;
|
||||||
|
public event EventHandler? CurrentTimeChanged;
|
||||||
|
public event EventHandler? PixelsPerSecondChanged;
|
||||||
|
public event EventHandler? SuspendEditingChanged;
|
||||||
|
public event EventHandler? ProfilePreviewUpdated;
|
||||||
|
|
||||||
#region Copy/paste
|
#region Copy/paste
|
||||||
|
|
||||||
public ProfileElement? DuplicateProfileElement(ProfileElement profileElement)
|
public ProfileElement? DuplicateProfileElement(ProfileElement profileElement)
|
||||||
@ -507,64 +566,5 @@ namespace Artemis.UI.Shared.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Events
|
|
||||||
|
|
||||||
public event EventHandler<ProfileConfigurationEventArgs>? SelectedProfileChanged;
|
|
||||||
public event EventHandler<ProfileConfigurationEventArgs>? SelectedProfileSaved;
|
|
||||||
public event EventHandler<RenderProfileElementEventArgs>? SelectedProfileElementChanged;
|
|
||||||
public event EventHandler<RenderProfileElementEventArgs>? SelectedProfileElementSaved;
|
|
||||||
public event EventHandler? SelectedDataBindingChanged;
|
|
||||||
public event EventHandler? CurrentTimeChanged;
|
|
||||||
public event EventHandler? PixelsPerSecondChanged;
|
|
||||||
public event EventHandler? SuspendEditingChanged;
|
|
||||||
public event EventHandler? ProfilePreviewUpdated;
|
|
||||||
|
|
||||||
protected virtual void OnSelectedProfileChanged(ProfileConfigurationEventArgs e)
|
|
||||||
{
|
|
||||||
SelectedProfileChanged?.Invoke(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSelectedProfileUpdated(ProfileConfigurationEventArgs e)
|
|
||||||
{
|
|
||||||
SelectedProfileSaved?.Invoke(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSelectedProfileElementChanged(RenderProfileElementEventArgs e)
|
|
||||||
{
|
|
||||||
SelectedProfileElementChanged?.Invoke(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSelectedProfileElementUpdated(RenderProfileElementEventArgs e)
|
|
||||||
{
|
|
||||||
SelectedProfileElementSaved?.Invoke(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnCurrentTimeChanged()
|
|
||||||
{
|
|
||||||
CurrentTimeChanged?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnPixelsPerSecondChanged()
|
|
||||||
{
|
|
||||||
PixelsPerSecondChanged?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSuspendEditingChanged()
|
|
||||||
{
|
|
||||||
SuspendEditingChanged?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnProfilePreviewUpdated()
|
|
||||||
{
|
|
||||||
ProfilePreviewUpdated?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSelectedDataBindingChanged()
|
|
||||||
{
|
|
||||||
SelectedDataBindingChanged?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
43
src/Artemis.UI.Shared/Utilities/TypeUtilities.cs
Normal file
43
src/Artemis.UI.Shared/Utilities/TypeUtilities.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Artemis.Core;
|
||||||
|
using Artemis.Core.Services;
|
||||||
|
using SkiaSharp;
|
||||||
|
using SkiaSharp.Views.WPF;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Shared
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides UI-oriented utilities for types
|
||||||
|
/// </summary>
|
||||||
|
public static class TypeUtilities
|
||||||
|
{
|
||||||
|
internal static INodeService? NodeService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a tuple containing a color and a slightly darkened color for a given type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type to create the color for</param>
|
||||||
|
public static (Color, Color) GetTypeColors(Type type)
|
||||||
|
{
|
||||||
|
if (type == typeof(object))
|
||||||
|
return (new SKColor(0xFFFFFF).ToColor(), new SKColor(0xFFFFFF).Darken(0.35f).ToColor());
|
||||||
|
|
||||||
|
TypeColorRegistration? typeColorRegistration = NodeService?.GetTypeColor(type);
|
||||||
|
if (typeColorRegistration != null)
|
||||||
|
return (typeColorRegistration.Color.ToColor(), typeColorRegistration.DarkenedColor.ToColor());
|
||||||
|
|
||||||
|
// Come up with a random color based on the type name that should be the same each time
|
||||||
|
MD5 md5Hasher = MD5.Create();
|
||||||
|
byte[] hashed = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(type.FullName!));
|
||||||
|
int hash = BitConverter.ToInt32(hashed, 0);
|
||||||
|
|
||||||
|
SKColor baseColor = SKColor.FromHsl(hash % 255, 50 + hash % 50, 50);
|
||||||
|
SKColor darkenedColor = baseColor.Darken(0.35f);
|
||||||
|
|
||||||
|
return (baseColor.ToColor(), darkenedColor.ToColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -94,7 +94,8 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
|||||||
|
|
||||||
private void Update(RenderProfileElement renderProfileElement)
|
private void Update(RenderProfileElement renderProfileElement)
|
||||||
{
|
{
|
||||||
if (RenderProfileElement != null) RenderProfileElement.Timeline.PropertyChanged -= TimelineOnPropertyChanged;
|
if (RenderProfileElement != null)
|
||||||
|
RenderProfileElement.Timeline.PropertyChanged -= TimelineOnPropertyChanged;
|
||||||
|
|
||||||
RenderProfileElement = renderProfileElement;
|
RenderProfileElement = renderProfileElement;
|
||||||
|
|
||||||
@ -102,7 +103,8 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
|||||||
NotifyOfPropertyChange(nameof(AlwaysFinishTimeline));
|
NotifyOfPropertyChange(nameof(AlwaysFinishTimeline));
|
||||||
NotifyOfPropertyChange(nameof(ConditionBehaviourEnabled));
|
NotifyOfPropertyChange(nameof(ConditionBehaviourEnabled));
|
||||||
|
|
||||||
RenderProfileElement.Timeline.PropertyChanged += TimelineOnPropertyChanged;
|
if (RenderProfileElement != null)
|
||||||
|
RenderProfileElement.Timeline.PropertyChanged += TimelineOnPropertyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Event handlers
|
#region Event handlers
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
@ -12,6 +13,7 @@ using Artemis.UI.Shared.Services;
|
|||||||
using Artemis.UI.SkiaSharp;
|
using Artemis.UI.SkiaSharp;
|
||||||
using Artemis.VisualScripting.Nodes;
|
using Artemis.VisualScripting.Nodes;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.UI.Services
|
namespace Artemis.UI.Services
|
||||||
{
|
{
|
||||||
@ -119,6 +121,13 @@ namespace Artemis.UI.Services
|
|||||||
|
|
||||||
public void RegisterBuiltInNodeTypes()
|
public void RegisterBuiltInNodeTypes()
|
||||||
{
|
{
|
||||||
|
_nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(bool), new SKColor(0xFFCD3232));
|
||||||
|
_nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(string), new SKColor(0xFFFFD700));
|
||||||
|
_nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(int), new SKColor(0xFF32CD32));
|
||||||
|
_nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(double), new SKColor(0xFF1E90FF));
|
||||||
|
_nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(float), new SKColor(0xFFFF7C00));
|
||||||
|
_nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(IList), new SKColor(0xFFC842FF));
|
||||||
|
|
||||||
foreach (Type nodeType in typeof(SumIntegersNode).Assembly.GetTypes().Where(t => typeof(INode).IsAssignableFrom(t) && t.IsPublic && !t.IsAbstract && !t.IsInterface))
|
foreach (Type nodeType in typeof(SumIntegersNode).Assembly.GetTypes().Where(t => typeof(INode).IsAssignableFrom(t) && t.IsPublic && !t.IsAbstract && !t.IsInterface))
|
||||||
_nodeService.RegisterNodeType(Constants.CorePlugin, nodeType);
|
_nodeService.RegisterNodeType(Constants.CorePlugin, nodeType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
|
using Artemis.UI.Shared;
|
||||||
using Artemis.VisualScripting.Editor.Controls.Wrapper;
|
using Artemis.VisualScripting.Editor.Controls.Wrapper;
|
||||||
|
|
||||||
namespace Artemis.VisualScripting.Editor.Controls
|
namespace Artemis.VisualScripting.Editor.Controls
|
||||||
@ -51,7 +52,7 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
|
|
||||||
public Point ValuePosition
|
public Point ValuePosition
|
||||||
{
|
{
|
||||||
get => (Point)GetValue(ValuePositionProperty);
|
get => (Point) GetValue(ValuePositionProperty);
|
||||||
set => SetValue(ValuePositionProperty, value);
|
set => SetValue(ValuePositionProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
{
|
{
|
||||||
_path = GetTemplateChild(PART_PATH) as Path ?? throw new NullReferenceException($"The Path '{PART_PATH}' is missing.");
|
_path = GetTemplateChild(PART_PATH) as Path ?? throw new NullReferenceException($"The Path '{PART_PATH}' is missing.");
|
||||||
_path.MouseDown += OnPathMouseDown;
|
_path.MouseDown += OnPathMouseDown;
|
||||||
|
|
||||||
Unloaded += OnUnloaded;
|
Unloaded += OnUnloaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
UpdateBorderBrush();
|
UpdateBorderBrush();
|
||||||
UpdateValuePosition();
|
UpdateValuePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPinPropertyChanged(object sender, PropertyChangedEventArgs e)
|
private void OnPinPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(VisualScriptPin.AbsolutePosition))
|
if (e.PropertyName == nameof(VisualScriptPin.AbsolutePosition))
|
||||||
@ -119,15 +120,15 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
|
|
||||||
private void UpdateBorderBrush()
|
private void UpdateBorderBrush()
|
||||||
{
|
{
|
||||||
// if (Cable.From.Pin.Type.IsAssignableTo(typeof(IList)))
|
(Color color, Color _) = TypeUtilities.GetTypeColors(Cable.From.Pin.Type);
|
||||||
// BorderBrush = new SolidColorBrush(Colors.MediumPurple);
|
BorderBrush = new SolidColorBrush(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateValuePosition()
|
private void UpdateValuePosition()
|
||||||
{
|
{
|
||||||
if (Cable.From == null || Cable.To == null)
|
if (Cable.From == null || Cable.To == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ValuePosition = new Point(
|
ValuePosition = new Point(
|
||||||
Cable.From.AbsolutePosition.X + ((Cable.To.AbsolutePosition.X - Cable.From.AbsolutePosition.X) / 2),
|
Cable.From.AbsolutePosition.X + ((Cable.To.AbsolutePosition.X - Cable.From.AbsolutePosition.X) / 2),
|
||||||
Cable.From.AbsolutePosition.Y + ((Cable.To.AbsolutePosition.Y - Cable.From.AbsolutePosition.Y) / 2)
|
Cable.From.AbsolutePosition.Y + ((Cable.To.AbsolutePosition.Y - Cable.From.AbsolutePosition.Y) / 2)
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
|
using Artemis.UI.Shared;
|
||||||
using Artemis.VisualScripting.Editor.Controls.Wrapper;
|
using Artemis.VisualScripting.Editor.Controls.Wrapper;
|
||||||
|
|
||||||
namespace Artemis.VisualScripting.Editor.Controls
|
namespace Artemis.VisualScripting.Editor.Controls
|
||||||
@ -108,9 +109,17 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
if (args.NewValue is VisualScriptPin newPin)
|
if (args.NewValue is VisualScriptPin newPin)
|
||||||
newPin.Node.Node.PropertyChanged += OnNodePropertyChanged;
|
newPin.Node.Node.PropertyChanged += OnNodePropertyChanged;
|
||||||
|
|
||||||
|
UpdateBrushes();
|
||||||
UpdateAbsoluteLocation();
|
UpdateAbsoluteLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateBrushes()
|
||||||
|
{
|
||||||
|
(Color border, Color background) = TypeUtilities.GetTypeColors(Pin.Pin.Type);
|
||||||
|
Background = new SolidColorBrush(background);
|
||||||
|
BorderBrush = new SolidColorBrush(border);
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateAbsoluteLocation()
|
private void UpdateAbsoluteLocation()
|
||||||
{
|
{
|
||||||
if ((Pin == null) || (_nodePresenter == null)) return;
|
if ((Pin == null) || (_nodePresenter == null)) return;
|
||||||
|
|||||||
@ -62,26 +62,6 @@
|
|||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter Property="Thickness" Value="6" />
|
<Setter Property="Thickness" Value="6" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Cable.From.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:Boolean}">
|
|
||||||
<Setter Property="BorderBrush" Value="#FFCD3232" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Cable.From.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:Int32}">
|
|
||||||
<Setter Property="BorderBrush" Value="LimeGreen" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Cable.From.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:Double}">
|
|
||||||
<Setter Property="BorderBrush" Value="DodgerBlue" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Cable.From.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:String}">
|
|
||||||
<Setter Property="BorderBrush" Value="Gold" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Cable.From.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type collections:IList}">
|
|
||||||
<Setter Property="BorderBrush" Value="MediumPurple" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|||||||
@ -80,31 +80,6 @@
|
|||||||
<Setter Property="Padding" Value="6,0,0,0" />
|
<Setter Property="Padding" Value="6,0,0,0" />
|
||||||
<Setter Property="Template" Value="{StaticResource TemplateVisualScriptPinPresenterOutput}" />
|
<Setter Property="Template" Value="{StaticResource TemplateVisualScriptPinPresenterOutput}" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Pin.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:Object}">
|
|
||||||
<Setter Property="Background" Value="#FFA0A0A0" />
|
|
||||||
<Setter Property="BorderBrush" Value="White" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Pin.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:Boolean}">
|
|
||||||
<Setter Property="Background" Value="DarkRed" />
|
|
||||||
<Setter Property="BorderBrush" Value="#FFCD3232" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Pin.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:Int32}">
|
|
||||||
<Setter Property="Background" Value="DarkGreen" />
|
|
||||||
<Setter Property="BorderBrush" Value="LimeGreen" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Pin.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:Double}">
|
|
||||||
<Setter Property="Background" Value="Blue" />
|
|
||||||
<Setter Property="BorderBrush" Value="DodgerBlue" />
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding Pin.Pin.Type, RelativeSource={RelativeSource Self}}" Value="{x:Type system:String}">
|
|
||||||
<Setter Property="Background" Value="DarkGoldenrod" />
|
|
||||||
<Setter Property="BorderBrush" Value="Gold" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user