diff --git a/src/Artemis.Core/Models/Profile/DataBindings/DataBindingRegistration.cs b/src/Artemis.Core/Models/Profile/DataBindings/DataBindingRegistration.cs index 78e233fe1..ab50c44c9 100644 --- a/src/Artemis.Core/Models/Profile/DataBindings/DataBindingRegistration.cs +++ b/src/Artemis.Core/Models/Profile/DataBindings/DataBindingRegistration.cs @@ -64,5 +64,15 @@ namespace Artemis.Core DataBinding = new DataBinding(LayerProperty, dataBinding); return DataBinding; } + + /// + public void ClearDataBinding() + { + if (DataBinding == null) + return; + + // The related entity is left behind, just in case the data binding is added back later + LayerProperty.DisableDataBinding(DataBinding); + } } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/DataBindings/IDataBindingRegistration.cs b/src/Artemis.Core/Models/Profile/DataBindings/IDataBindingRegistration.cs index 8e1de1f0a..c1321d4c3 100644 --- a/src/Artemis.Core/Models/Profile/DataBindings/IDataBindingRegistration.cs +++ b/src/Artemis.Core/Models/Profile/DataBindings/IDataBindingRegistration.cs @@ -20,5 +20,10 @@ /// /// IDataBinding? CreateDataBinding(); + + /// + /// If present, removes the current data binding + /// + void ClearDataBinding(); } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs index 61f38c428..c35bc401d 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs @@ -420,6 +420,14 @@ namespace Artemis.Core DataBindingRegistration registration = new(this, converter, getter, setter, displayName); _dataBindingRegistrations.Add(registration); + // If not yet initialized, load the data binding related to the registration if available + if (_isInitialized) + { + IDataBinding? dataBinding = registration.CreateDataBinding(); + if (dataBinding != null) + _dataBindings.Add(dataBinding); + } + OnDataBindingPropertyRegistered(); return registration; } @@ -432,7 +440,10 @@ namespace Artemis.Core if (_disposed) throw new ObjectDisposedException("LayerProperty"); + foreach (IDataBindingRegistration dataBindingRegistration in _dataBindingRegistrations) + dataBindingRegistration.ClearDataBinding(); _dataBindingRegistrations.Clear(); + OnDataBindingPropertiesCleared(); } diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index 21e82e6b1..ffb154dac 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -295,7 +295,7 @@ namespace Artemis.UI.Shared { Execute.PostToUIThread(SetupForDevice); } - + private void Render() { DrawingContext drawingContext = _backingStore.Open(); diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs index 640812016..a4bf80753 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs @@ -51,7 +51,6 @@ namespace Artemis.UI.Shared byte g = Led.RgbLed.Color.GetG(); byte b = Led.RgbLed.Color.GetB(); - _renderColor.A = (byte) (isDimmed ? 100 : 255); _renderColor.A = isDimmed ? Dimmed : NonDimmed; _renderColor.R = r; _renderColor.G = g;