mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Condition operators - Marked built-in operators as internal
Display conditions - Added docs to the service and profile types Color gradient - Added docs Storage - Moved profile entities to separate namespaces Data bindings - Added entities to storage Data bindings - Started implementing in the core
This commit is contained in:
1 parent
d34992c719
commit
e5d1b7b23f
43 files changed
+1059
-324
No files matched your search
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Plugins.DataModelExpansions;
|
||||
|
||||
namespace Artemis.Core.Models.Profile.DataBindings
|
||||
{
|
||||
/// <summary>
|
||||
/// A data binding that binds a certain <see cref="BaseLayerProperty" /> to a value inside a <see cref="DataModel" />
|
||||
/// </summary>
|
||||
public class DataBinding
|
||||
{
|
||||
private readonly List<DataBindingModifier> _modifiers = new List<DataBindingModifier>();
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="BaseLayerProperty" /> that the data binding targets
|
||||
/// </summary>
|
||||
public BaseLayerProperty Target { get; set; } // BIG FAT TODO: Take into account X and Y of SkPosition etc., forgot about it again :>
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently used instance of the data model that contains the source of the data binding
|
||||
/// </summary>
|
||||
public DataModel SourceDataModel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path of the source property in the <see cref="SourceDataModel" />
|
||||
/// </summary>
|
||||
public string SourcePropertyPath { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of modifiers applied to this data binding
|
||||
/// </summary>
|
||||
public IReadOnlyList<DataBindingModifier> Modifiers => _modifiers.AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a modifier to the data binding's <see cref="Modifiers" /> collection
|
||||
/// </summary>
|
||||
public void AddModifier(DataBindingModifier modifier)
|
||||
{
|
||||
if (!_modifiers.Contains(modifier))
|
||||
{
|
||||
modifier.DataBinding = this;
|
||||
modifier.CreateExpression();
|
||||
_modifiers.Add(modifier);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a modifier from the data binding's <see cref="Modifiers" /> collection
|
||||
/// </summary>
|
||||
public void RemoveModifier(DataBindingModifier modifier)
|
||||
{
|
||||
if (_modifiers.Contains(modifier))
|
||||
{
|
||||
modifier.DataBinding = null;
|
||||
modifier.CreateExpression();
|
||||
_modifiers.Remove(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user