mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Data bindings - Rewrote data binding system to fully leverage nodes
This commit is contained in:
1 parent
7933bf7ee9
commit
0bb93f2ebd
63 files changed
+654
-1533
No files matched your search
@@ -44,6 +44,11 @@ namespace Artemis.UI.Shared
|
||||
/// </summary>
|
||||
public LayerProperty<T> LayerProperty { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the layer property should be enabled
|
||||
/// </summary>
|
||||
public bool IsEnabled => !LayerProperty.HasDataBinding;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the profile editor service
|
||||
/// </summary>
|
||||
@@ -85,8 +90,8 @@ namespace Artemis.UI.Shared
|
||||
{
|
||||
LayerProperty.Updated += LayerPropertyOnUpdated;
|
||||
LayerProperty.CurrentValueSet += LayerPropertyOnUpdated;
|
||||
LayerProperty.DataBindingEnabled += LayerPropertyOnDataBindingChange;
|
||||
LayerProperty.DataBindingDisabled += LayerPropertyOnDataBindingChange;
|
||||
LayerProperty.DataBinding.DataBindingEnabled += OnDataBindingChange;
|
||||
LayerProperty.DataBinding.DataBindingDisabled += OnDataBindingChange;
|
||||
UpdateInputValue();
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
@@ -96,8 +101,8 @@ namespace Artemis.UI.Shared
|
||||
{
|
||||
LayerProperty.Updated -= LayerPropertyOnUpdated;
|
||||
LayerProperty.CurrentValueSet -= LayerPropertyOnUpdated;
|
||||
LayerProperty.DataBindingEnabled -= LayerPropertyOnDataBindingChange;
|
||||
LayerProperty.DataBindingDisabled -= LayerPropertyOnDataBindingChange;
|
||||
LayerProperty.DataBinding.DataBindingEnabled -= OnDataBindingChange;
|
||||
LayerProperty.DataBinding.DataBindingDisabled -= OnDataBindingChange;
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
@@ -194,8 +199,9 @@ namespace Artemis.UI.Shared
|
||||
UpdateInputValue();
|
||||
}
|
||||
|
||||
private void LayerPropertyOnDataBindingChange(object? sender, LayerPropertyEventArgs e)
|
||||
private void OnDataBindingChange(object? sender, DataBindingEventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||
OnDataBindingsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace Artemis.UI.Shared.Services
|
||||
RenderProfileElement? SelectedProfileElement { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently selected data binding property
|
||||
/// Gets the currently selected data binding
|
||||
/// </summary>
|
||||
ILayerProperty? SelectedDataBinding { get; }
|
||||
IDataBinding? SelectedDataBinding { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current time
|
||||
@@ -89,10 +89,10 @@ namespace Artemis.UI.Shared.Services
|
||||
void SaveSelectedProfileElement();
|
||||
|
||||
/// <summary>
|
||||
/// Changes the selected data binding property
|
||||
/// Changes the selected data binding
|
||||
/// </summary>
|
||||
/// <param name="layerProperty">The data binding property to select</param>
|
||||
void ChangeSelectedDataBinding(ILayerProperty? layerProperty);
|
||||
/// <param name="dataBinding">The data binding to select</param>
|
||||
void ChangeSelectedDataBinding(IDataBinding? dataBinding);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the profile preview, forcing UI-elements to re-render
|
||||
@@ -114,7 +114,7 @@ namespace Artemis.UI.Shared.Services
|
||||
/// <summary>
|
||||
/// Registers a new property input view model used in the profile editor for the generic type defined in
|
||||
/// <see cref="PropertyInputViewModel{T}" />
|
||||
/// <para>Note: Registration will remove itself on plugin disable so you don't have to</para>
|
||||
/// <para>Note: DataBindingProperty will remove itself on plugin disable so you don't have to</para>
|
||||
/// </summary>
|
||||
/// <param name="plugin"></param>
|
||||
/// <returns></returns>
|
||||
@@ -123,7 +123,7 @@ namespace Artemis.UI.Shared.Services
|
||||
/// <summary>
|
||||
/// Registers a new property input view model used in the profile editor for the generic type defined in
|
||||
/// <see cref="PropertyInputViewModel{T}" />
|
||||
/// <para>Note: Registration will remove itself on plugin disable so you don't have to</para>
|
||||
/// <para>Note: DataBindingProperty will remove itself on plugin disable so you don't have to</para>
|
||||
/// </summary>
|
||||
/// <param name="viewModelType"></param>
|
||||
/// <param name="plugin"></param>
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Artemis.UI.Shared.Services
|
||||
// Trigger selected data binding change
|
||||
if (SelectedDataBinding != null)
|
||||
{
|
||||
SelectedDataBinding = SelectedProfileElement?.GetAllLayerProperties().FirstOrDefault(p => p.Path == SelectedDataBinding.Path);
|
||||
SelectedDataBinding = SelectedProfileElement?.GetAllLayerProperties().FirstOrDefault(p => p.Path == SelectedDataBinding.BaseLayerProperty.Path)?.BaseDataBinding;
|
||||
OnSelectedDataBindingChanged();
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Artemis.UI.Shared.Services
|
||||
public ProfileConfiguration? SelectedProfileConfiguration { get; private set; }
|
||||
public Profile? SelectedProfile => SelectedProfileConfiguration?.Profile;
|
||||
public RenderProfileElement? SelectedProfileElement { get; private set; }
|
||||
public ILayerProperty? SelectedDataBinding { get; private set; }
|
||||
public IDataBinding? SelectedDataBinding { get; private set; }
|
||||
|
||||
public TimeSpan CurrentTime
|
||||
{
|
||||
@@ -303,9 +303,9 @@ namespace Artemis.UI.Shared.Services
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeSelectedDataBinding(ILayerProperty? layerProperty)
|
||||
public void ChangeSelectedDataBinding(IDataBinding? dataBinding)
|
||||
{
|
||||
SelectedDataBinding = layerProperty;
|
||||
SelectedDataBinding = dataBinding;
|
||||
OnSelectedDataBindingChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user