diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs
index f865fae4e..b86126d13 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Reflection;
using Artemis.Core.Events;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Storage.Entities.Profile;
@@ -71,6 +72,9 @@ namespace Artemis.Core.Models.Profile.LayerProperties
///
public bool IsCoreProperty { get; internal set; }
+ ///
+ /// Gets the description attribute applied to this property
+ ///
public PropertyDescriptionAttribute PropertyDescription { get; internal set; }
///
@@ -81,8 +85,21 @@ namespace Artemis.Core.Models.Profile.LayerProperties
internal PropertyEntity PropertyEntity { get; set; }
internal LayerPropertyGroup LayerPropertyGroup { get; set; }
+ ///
+ /// Overrides the property value with the default value
+ ///
public abstract void ApplyDefaultValue();
+ ///
+ /// Returns the type of the property
+ ///
+ public abstract Type GetPropertyType();
+
+ ///
+ /// Returns a list of properties to which data bindings can be applied
+ ///
+ ///
+ public abstract List GetDataBindingProperties();
///
/// Applies the provided property entity to the layer property by deserializing the JSON base value and keyframe values
diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
index 2bc74e86b..10773047a 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+using System.Reflection;
using Artemis.Core.Exceptions;
using Artemis.Core.Utilities;
using Artemis.Storage.Entities.Profile;
@@ -166,12 +167,22 @@ namespace Artemis.Core.Models.Profile.LayerProperties
RemoveKeyframe(layerPropertyKeyframe);
}
+ ///
public override void ApplyDefaultValue()
{
BaseValue = DefaultValue;
CurrentValue = DefaultValue;
}
+ ///
+ public override Type GetPropertyType() => typeof(T);
+
+ ///
+ public override List GetDataBindingProperties()
+ {
+ return new List {GetType().GetProperty(nameof(CurrentValue))};
+ }
+
///
/// Called every update (if keyframes are both supported and enabled) to determine the new
/// based on the provided progress
@@ -206,8 +217,8 @@ namespace Artemis.Core.Models.Profile.LayerProperties
else
{
var timeDiff = NextKeyframe.Position - CurrentKeyframe.Position;
- var keyframeProgress = (float)((ProfileElement.TimelinePosition - CurrentKeyframe.Position).TotalMilliseconds / timeDiff.TotalMilliseconds);
- var keyframeProgressEased = (float)Easings.Interpolate(keyframeProgress, CurrentKeyframe.EasingFunction);
+ var keyframeProgress = (float) ((ProfileElement.TimelinePosition - CurrentKeyframe.Position).TotalMilliseconds / timeDiff.TotalMilliseconds);
+ var keyframeProgressEased = (float) Easings.Interpolate(keyframeProgress, CurrentKeyframe.EasingFunction);
UpdateCurrentValue(keyframeProgress, keyframeProgressEased);
}
@@ -245,7 +256,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
_keyframes.AddRange(entity.KeyframeEntities.Select(k => new LayerPropertyKeyframe(
JsonConvert.DeserializeObject(k.Value),
k.Position,
- (Easings.Functions)k.EasingFunction,
+ (Easings.Functions) k.EasingFunction,
this
)));
}
@@ -274,7 +285,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
{
Value = JsonConvert.SerializeObject(k.Value),
Position = k.Position,
- EasingFunction = (int)k.EasingFunction
+ EasingFunction = (int) k.EasingFunction
}));
}
}
diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs
index 11aa9c68a..9fc026286 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs
@@ -1,4 +1,7 @@
-using SkiaSharp;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
{
@@ -20,5 +23,10 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types
var heightDiff = NextKeyframe.Value.Height - CurrentKeyframe.Value.Height;
CurrentValue = new SKSize(CurrentKeyframe.Value.Width + widthDiff * keyframeProgressEased, CurrentKeyframe.Value.Height + heightDiff * keyframeProgressEased);
}
+
+ public override List GetDataBindingProperties()
+ {
+ return typeof(SKSize).GetProperties().ToList();
+ }
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/DataBindingService.cs b/src/Artemis.Core/Services/DataBindingService.cs
new file mode 100644
index 000000000..1fa8e0e10
--- /dev/null
+++ b/src/Artemis.Core/Services/DataBindingService.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Artemis.Core.Services.Interfaces;
+
+namespace Artemis.Core.Services
+{
+ public class DataBindingService : IDataBindingService
+ {
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/Interfaces/IDataBindingService.cs b/src/Artemis.Core/Services/Interfaces/IDataBindingService.cs
new file mode 100644
index 000000000..b8caaf2ed
--- /dev/null
+++ b/src/Artemis.Core/Services/Interfaces/IDataBindingService.cs
@@ -0,0 +1,6 @@
+namespace Artemis.Core.Services.Interfaces
+{
+ public interface IDataBindingService : IArtemisService
+ {
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs
index 397ea40d8..20031e3a4 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelVisualizationRegistration.cs
@@ -3,20 +3,21 @@ using System.Collections.Generic;
using Artemis.Core;
using Artemis.Core.Plugins;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.UI.Shared.DataModelVisualization
{
public class DataModelVisualizationRegistration
{
- private readonly IDataModelVisualizationService _dataModelVisualizationService;
+ private readonly IDataModelUIService _dataModelUIService;
- public DataModelVisualizationRegistration(IDataModelVisualizationService dataModelVisualizationService,
+ public DataModelVisualizationRegistration(IDataModelUIService dataModelUIService,
RegistrationType registrationType,
PluginInfo pluginInfo,
Type supportedType,
Type viewModelType)
{
- _dataModelVisualizationService = dataModelVisualizationService;
+ _dataModelUIService = dataModelUIService;
RegistrationType = registrationType;
PluginInfo = pluginInfo;
SupportedType = supportedType;
@@ -42,9 +43,9 @@ namespace Artemis.UI.Shared.DataModelVisualization
private void InstanceOnPluginDisabled(object sender, EventArgs e)
{
if (RegistrationType == RegistrationType.Input)
- _dataModelVisualizationService.RemoveDataModelInput(this);
+ _dataModelUIService.RemoveDataModelInput(this);
else if (RegistrationType == RegistrationType.Display)
- _dataModelVisualizationService.RemoveDataModelDisplay(this);
+ _dataModelUIService.RemoveDataModelDisplay(this);
}
}
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertiesViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertiesViewModel.cs
index 0b7a76f94..2dbb222d3 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertiesViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertiesViewModel.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Reflection;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.UI.Shared.DataModelVisualization.Shared
{
@@ -38,16 +39,16 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
public override string DisplayPropertyPath => null;
- public override void Update(IDataModelVisualizationService dataModelVisualizationService)
+ public override void Update(IDataModelUIService dataModelUIService)
{
// Display value gets updated by parent, don't do anything if it is null
if (DisplayValue == null)
return;
ListType = DisplayValue.GetType();
- PopulateProperties(dataModelVisualizationService);
+ PopulateProperties(dataModelUIService);
foreach (var dataModelVisualizationViewModel in Children)
- dataModelVisualizationViewModel.Update(dataModelVisualizationService);
+ dataModelVisualizationViewModel.Update(dataModelUIService);
}
public override object GetCurrentValue()
@@ -55,14 +56,14 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
return DisplayValue;
}
- private void PopulateProperties(IDataModelVisualizationService dataModelVisualizationService)
+ private void PopulateProperties(IDataModelUIService dataModelUIService)
{
if (Children.Any())
return;
foreach (var propertyInfo in ListType.GetProperties())
{
- var child = CreateChild(dataModelVisualizationService, propertyInfo, GetChildDepth());
+ var child = CreateChild(dataModelUIService, propertyInfo, GetChildDepth());
if (child != null)
Children.Add(child);
}
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs
index e6270de43..95f8f81fb 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Reflection;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.UI.Shared.DataModelVisualization.Shared
{
@@ -32,14 +33,14 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
return DisplayValue;
}
- public override void Update(IDataModelVisualizationService dataModelVisualizationService)
+ public override void Update(IDataModelUIService dataModelUIService)
{
// Display value gets updated by parent, don't do anything if it is null
if (DisplayValue == null)
return;
- if (DisplayViewModel == null && dataModelVisualizationService.RegisteredDataModelDisplays.Any(d => d.SupportedType == DisplayValue.GetType()))
- dataModelVisualizationService.GetDataModelDisplayViewModel(DisplayValue.GetType());
+ if (DisplayViewModel == null && dataModelUIService.RegisteredDataModelDisplays.Any(d => d.SupportedType == DisplayValue.GetType()))
+ dataModelUIService.GetDataModelDisplayViewModel(DisplayValue.GetType());
ListType = DisplayValue.GetType();
UpdateDisplayParameters();
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs
index b7e2dbeca..2c18777b1 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs
@@ -4,6 +4,7 @@ using System.Reflection;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
using Stylet;
namespace Artemis.UI.Shared.DataModelVisualization.Shared
@@ -33,16 +34,16 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
set => SetAndNotify(ref _count, value);
}
- public DataModelPropertiesViewModel GetListTypeViewModel(IDataModelVisualizationService dataModelVisualizationService)
+ public DataModelPropertiesViewModel GetListTypeViewModel(IDataModelUIService dataModelUIService)
{
// Create a property VM describing the type of the list
- var viewModel = CreateListChild(dataModelVisualizationService, List.GetType().GenericTypeArguments[0]);
+ var viewModel = CreateListChild(dataModelUIService, List.GetType().GenericTypeArguments[0]);
// Put an empty value into the list type property view model
if (viewModel is DataModelListPropertiesViewModel dataModelListClassViewModel)
{
dataModelListClassViewModel.DisplayValue = Activator.CreateInstance(dataModelListClassViewModel.ListType);
- dataModelListClassViewModel.Update(dataModelVisualizationService);
+ dataModelListClassViewModel.Update(dataModelUIService);
return dataModelListClassViewModel;
}
@@ -57,7 +58,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
return null;
}
- public override void Update(IDataModelVisualizationService dataModelVisualizationService)
+ public override void Update(IDataModelUIService dataModelUIService)
{
if (Parent != null && !Parent.IsVisualizationExpanded)
return;
@@ -72,7 +73,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
DataModelVisualizationViewModel child;
if (ListChildren.Count <= index)
{
- child = CreateListChild(dataModelVisualizationService, item.GetType());
+ child = CreateListChild(dataModelUIService, item.GetType());
ListChildren.Add(child);
}
else
@@ -89,7 +90,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
dataModelListPropertyViewModel.Index = index;
}
- child.Update(dataModelVisualizationService);
+ child.Update(dataModelUIService);
index++;
}
@@ -99,10 +100,10 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
Count = $"{ListChildren.Count} {(ListChildren.Count == 1 ? "item" : "items")}";
}
- protected DataModelVisualizationViewModel CreateListChild(IDataModelVisualizationService dataModelVisualizationService, Type listType)
+ protected DataModelVisualizationViewModel CreateListChild(IDataModelUIService dataModelUIService, Type listType)
{
// If a display VM was found, prefer to use that in any case
- var typeViewModel = dataModelVisualizationService.GetDataModelDisplayViewModel(listType);
+ var typeViewModel = dataModelUIService.GetDataModelDisplayViewModel(listType);
if (typeViewModel != null)
return new DataModelListPropertyViewModel(DataModel, this, PropertyInfo) {DisplayViewModel = typeViewModel};
// For primitives, create a property view model, it may be null that is fine
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs
index 4cc0b0ee7..7ebe5b4b4 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertiesViewModel.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Reflection;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.UI.Shared.DataModelVisualization.Shared
{
@@ -12,17 +13,17 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
{
}
- public override void Update(IDataModelVisualizationService dataModelVisualizationService)
+ public override void Update(IDataModelUIService dataModelUIService)
{
// Always populate properties
- PopulateProperties(dataModelVisualizationService);
+ PopulateProperties(dataModelUIService);
// Only update children if the parent is expanded
if (Parent != null && !Parent.IsVisualizationExpanded && !Parent.IsRootViewModel)
return;
foreach (var dataModelVisualizationViewModel in Children)
- dataModelVisualizationViewModel.Update(dataModelVisualizationService);
+ dataModelVisualizationViewModel.Update(dataModelUIService);
}
public override object GetCurrentValue()
@@ -30,7 +31,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
return Parent.IsRootViewModel ? DataModel : base.GetCurrentValue();
}
- private void PopulateProperties(IDataModelVisualizationService dataModelVisualizationService)
+ private void PopulateProperties(IDataModelUIService dataModelUIService)
{
if (IsRootViewModel)
return;
@@ -42,7 +43,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
if (Children.Any(c => c.PropertyInfo.Equals(propertyInfo)))
continue;
- var child = CreateChild(dataModelVisualizationService, propertyInfo, GetChildDepth());
+ var child = CreateChild(dataModelUIService, propertyInfo, GetChildDepth());
if (child != null)
Children.Add(child);
}
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
index d057eaa42..2c2fad9a9 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelPropertyViewModel.cs
@@ -2,6 +2,7 @@
using System.Reflection;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.UI.Shared.DataModelVisualization.Shared
{
@@ -47,13 +48,13 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
set => SetAndNotify(ref _showViewModel, value);
}
- public override void Update(IDataModelVisualizationService dataModelVisualizationService)
+ public override void Update(IDataModelUIService dataModelUIService)
{
if (Parent != null && !Parent.IsVisualizationExpanded && !Parent.IsRootViewModel)
return;
- if (DisplayViewModel == null && dataModelVisualizationService.RegisteredDataModelDisplays.Any(d => d.SupportedType == PropertyInfo.PropertyType))
- dataModelVisualizationService.GetDataModelDisplayViewModel(PropertyInfo.PropertyType);
+ if (DisplayViewModel == null && dataModelUIService.RegisteredDataModelDisplays.Any(d => d.SupportedType == PropertyInfo.PropertyType))
+ dataModelUIService.GetDataModelDisplayViewModel(PropertyInfo.PropertyType);
DisplayValue = GetCurrentValue();
UpdateDisplayParameters();
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
index 301b0d7c6..e61b1d1a8 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
@@ -10,6 +10,7 @@ using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
using Artemis.UI.Shared.Exceptions;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
using Humanizer;
using Stylet;
@@ -122,8 +123,8 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
///
/// Updates the datamodel and if in an parent, any children
///
- ///
- public abstract void Update(IDataModelVisualizationService dataModelVisualizationService);
+ ///
+ public abstract void Update(IDataModelUIService dataModelUIService);
public virtual object GetCurrentValue()
{
@@ -230,7 +231,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
}
}
- protected DataModelVisualizationViewModel CreateChild(IDataModelVisualizationService dataModelVisualizationService, PropertyInfo propertyInfo, int depth)
+ protected DataModelVisualizationViewModel CreateChild(IDataModelUIService dataModelUIService, PropertyInfo propertyInfo, int depth)
{
if (depth > MaxDepth)
return null;
@@ -242,7 +243,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
return null;
// If a display VM was found, prefer to use that in any case
- var typeViewModel = dataModelVisualizationService.GetDataModelDisplayViewModel(propertyInfo.PropertyType);
+ var typeViewModel = dataModelUIService.GetDataModelDisplayViewModel(propertyInfo.PropertyType);
if (typeViewModel != null)
return new DataModelPropertyViewModel(DataModel, this, propertyInfo) {DisplayViewModel = typeViewModel, Depth = depth};
// For primitives, create a property view model, it may be null that is fine
diff --git a/src/Artemis.UI.Shared/Services/DataBindingUIService.cs b/src/Artemis.UI.Shared/Services/DataBindingUIService.cs
new file mode 100644
index 000000000..72e17938a
--- /dev/null
+++ b/src/Artemis.UI.Shared/Services/DataBindingUIService.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Artemis.UI.Shared.Services.Interfaces;
+
+namespace Artemis.UI.Shared.Services
+{
+ public class DataBindingUIService : IDataBindingUIService
+ {
+ public object GetDataBindingViewModel(Type propertyType)
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Services/DataModelVisualizationService.cs b/src/Artemis.UI.Shared/Services/DataModelUIService.cs
similarity index 80%
rename from src/Artemis.UI.Shared/Services/DataModelVisualizationService.cs
rename to src/Artemis.UI.Shared/Services/DataModelUIService.cs
index 47d5770dc..2333bb716 100644
--- a/src/Artemis.UI.Shared/Services/DataModelVisualizationService.cs
+++ b/src/Artemis.UI.Shared/Services/DataModelUIService.cs
@@ -1,30 +1,26 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using Artemis.Core.Extensions;
using Artemis.Core.Plugins;
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Shared.DataModelVisualization;
using Artemis.UI.Shared.DataModelVisualization.Shared;
-using Artemis.UI.Shared.Services.DataModelVisualization;
using Artemis.UI.Shared.Services.Interfaces;
using Ninject;
using Ninject.Parameters;
-using Stylet;
namespace Artemis.UI.Shared.Services
{
- internal class DataModelVisualizationService : IDataModelVisualizationService
+ internal class DataModelUIService : IDataModelUIService
{
private readonly IDataModelService _dataModelService;
private readonly IKernel _kernel;
private readonly List _registeredDataModelDisplays;
private readonly List _registeredDataModelEditors;
- public DataModelVisualizationService(IDataModelService dataModelService, IKernel kernel)
+ public DataModelUIService(IDataModelService dataModelService, IKernel kernel)
{
_dataModelService = dataModelService;
_kernel = kernel;
@@ -61,18 +57,7 @@ namespace Artemis.UI.Shared.Services
viewModel.UpdateRequested += (sender, args) => viewModel.Update(this);
return viewModel;
}
-
- // public DataModelPropertiesViewModel GetListDataModelVisualization(IList list)
- // {
- // var viewModel = new DataModelPropertiesViewModel(null, null, null);
- // viewModel.Children.Add(new DataModelListPropertiesViewModel(null, viewModel, null) {DisplayValue = list});
- //
- // // Update to populate children
- // viewModel.Update(this);
- // viewModel.UpdateRequested += (sender, args) => viewModel.Update(this);
- // return viewModel;
- // }
-
+
public bool GetPluginExtendsDataModel(Plugin plugin)
{
return _dataModelService.GetPluginExtendsDataModel(plugin);
@@ -90,8 +75,11 @@ namespace Artemis.UI.Shared.Services
if (existing != null)
{
if (existing.PluginInfo != pluginInfo)
+ {
throw new ArtemisPluginException($"Cannot register data model input for type {supportedType.Name} " +
$"because an editor was already registered by {pluginInfo.Name}");
+ }
+
return existing;
}
@@ -119,8 +107,11 @@ namespace Artemis.UI.Shared.Services
if (existing != null)
{
if (existing.PluginInfo != pluginInfo)
+ {
throw new ArtemisPluginException($"Cannot register data model display for type {supportedType.Name} " +
$"because an editor was already registered by {pluginInfo.Name}");
+ }
+
return existing;
}
@@ -214,27 +205,4 @@ namespace Artemis.UI.Shared.Services
return viewModel;
}
}
-
- public interface IDataModelVisualizationService : IArtemisSharedUIService
- {
- DataModelPropertiesViewModel GetMainDataModelVisualization();
- DataModelPropertiesViewModel GetPluginDataModelVisualization(Plugin plugin);
-
- ///
- /// Determines whether the given plugin expands the main data model
- ///
- ///
- ///
- bool GetPluginExtendsDataModel(Plugin plugin);
-
- DataModelVisualizationRegistration RegisterDataModelInput(PluginInfo pluginInfo, IReadOnlyCollection compatibleConversionTypes) where T : DataModelInputViewModel;
- DataModelVisualizationRegistration RegisterDataModelDisplay(PluginInfo pluginInfo) where T : DataModelDisplayViewModel;
- void RemoveDataModelInput(DataModelVisualizationRegistration registration);
- void RemoveDataModelDisplay(DataModelVisualizationRegistration registration);
-
- DataModelDisplayViewModel GetDataModelDisplayViewModel(Type propertyType);
- DataModelInputViewModel GetDataModelInputViewModel(Type propertyType, DataModelPropertyAttribute description, object initialValue, Action
event EventHandler SelectedProfileElementUpdated;
+ ///
+ /// Occurs when the currently selected data binding layer property is changed
+ ///
+ event EventHandler SelectedDataBindingChanged;
+
///
/// Occurs when the current editor time is changed
///
@@ -86,5 +92,5 @@ namespace Artemis.UI.Shared.Services.Interfaces
/// A keyframe to exclude during keyframe snapping
///
TimeSpan SnapToTimeline(TimeSpan time, TimeSpan tolerance, bool snapToSegments, bool snapToCurrentTime, bool snapToKeyframes, BaseLayerPropertyKeyframe excludedKeyframe = null);
- }
+ }
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Services/ProfileEditorService.cs b/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
index 5ed4072b8..97daadf8d 100644
--- a/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
+++ b/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
@@ -41,6 +41,7 @@ namespace Artemis.UI.Shared.Services
public IReadOnlyList RegisteredPropertyEditors => _registeredPropertyEditors.AsReadOnly();
public Profile SelectedProfile { get; private set; }
public RenderProfileElement SelectedProfileElement { get; private set; }
+ public BaseLayerProperty SelectedDataBinding { get; private set; }
public TimeSpan CurrentTime
{
@@ -131,6 +132,12 @@ namespace Artemis.UI.Shared.Services
}
}
+ public void ChangeSelectedDataBinding(BaseLayerProperty layerProperty)
+ {
+ SelectedDataBinding = layerProperty;
+ OnSelectedDataBindingChanged();
+ }
+
public void UpdateProfilePreview()
{
if (SelectedProfile == null)
@@ -276,6 +283,7 @@ namespace Artemis.UI.Shared.Services
public event EventHandler SelectedProfileUpdated;
public event EventHandler ProfileElementSelected;
public event EventHandler SelectedProfileElementUpdated;
+ public event EventHandler SelectedDataBindingChanged;
public event EventHandler CurrentTimeChanged;
public event EventHandler PixelsPerSecondChanged;
public event EventHandler ProfilePreviewUpdated;
@@ -325,5 +333,10 @@ namespace Artemis.UI.Shared.Services
{
Execute.PostToUIThread(() => ChangeSelectedProfile(null));
}
+
+ protected virtual void OnSelectedDataBindingChanged()
+ {
+ SelectedDataBindingChanged?.Invoke(this, EventArgs.Empty);
+ }
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListPredicateViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListPredicateViewModel.cs
index b5f903146..c8eee0de2 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListPredicateViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListPredicateViewModel.cs
@@ -24,7 +24,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
public class DisplayConditionListPredicateViewModel : DisplayConditionViewModel, IHandle, IHandle
{
private readonly IDataModelService _dataModelService;
- private readonly IDataModelVisualizationService _dataModelVisualizationService;
+ private readonly IDataModelUIService _dataModelUIService;
private readonly IEventAggregator _eventAggregator;
private readonly IProfileEditorService _profileEditorService;
private readonly Timer _updateTimer;
@@ -45,13 +45,13 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
DisplayConditionListPredicate displayConditionListPredicate,
DisplayConditionViewModel parent,
IProfileEditorService profileEditorService,
- IDataModelVisualizationService dataModelVisualizationService,
+ IDataModelUIService dataModelUIService,
IDataModelService dataModelService,
ISettingsService settingsService,
IEventAggregator eventAggregator) : base(displayConditionListPredicate, parent)
{
_profileEditorService = profileEditorService;
- _dataModelVisualizationService = dataModelVisualizationService;
+ _dataModelUIService = dataModelUIService;
_dataModelService = dataModelService;
_eventAggregator = eventAggregator;
_updateTimer = new Timer(500);
@@ -180,7 +180,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
RightSideDataModel.UpdateRequested += RightDataModelUpdateRequested;
// Determine which types are currently supported
- var editors = _dataModelVisualizationService.RegisteredDataModelEditors;
+ var editors = _dataModelUIService.RegisteredDataModelEditors;
_supportedInputTypes = editors.Select(e => e.SupportedType).ToList();
_supportedInputTypes.AddRange(editors.Where(e => e.CompatibleConversionTypes != null).SelectMany(e => e.CompatibleConversionTypes));
@@ -272,7 +272,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
return;
RightSideTransitionIndex = 1;
- RightSideInputViewModel = _dataModelVisualizationService.GetDataModelInputViewModel(
+ RightSideInputViewModel = _dataModelUIService.GetDataModelInputViewModel(
SelectedLeftSideProperty.PropertyInfo.PropertyType,
SelectedLeftSideProperty.PropertyDescription,
DisplayConditionListPredicate.RightStaticValue,
@@ -290,9 +290,9 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
private void OnUpdateTimerOnElapsed(object sender, ElapsedEventArgs e)
{
if (LeftSideDataModelOpen)
- LeftSideDataModel.Update(_dataModelVisualizationService);
+ LeftSideDataModel.Update(_dataModelUIService);
else if (RightSideDataModelOpen)
- RightSideDataModel.Update(_dataModelVisualizationService);
+ RightSideDataModel.Update(_dataModelUIService);
}
private void RightDataModelUpdateRequested(object sender, EventArgs e)
@@ -319,16 +319,16 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
if (DisplayConditionListPredicate.ListDataModel == null || DisplayConditionListPredicate.ListPropertyPath == null)
throw new ArtemisUIException("Cannot create a list predicate without first selecting a target list");
- var dataModel = _dataModelVisualizationService.GetMainDataModelVisualization();
- if (!_dataModelVisualizationService.GetPluginExtendsDataModel(_profileEditorService.GetCurrentModule()))
- dataModel.Children.Add(_dataModelVisualizationService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
+ var dataModel = _dataModelUIService.GetMainDataModelVisualization();
+ if (!_dataModelUIService.GetPluginExtendsDataModel(_profileEditorService.GetCurrentModule()))
+ dataModel.Children.Add(_dataModelUIService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
var listDataModel = (DataModelListViewModel) dataModel.GetChildByPath(
DisplayConditionListPredicate.ListDataModel.PluginInfo.Guid,
DisplayConditionListPredicate.ListPropertyPath
);
- return listDataModel.GetListTypeViewModel(_dataModelVisualizationService);
+ return listDataModel.GetListTypeViewModel(_dataModelUIService);
}
private void ExecuteSelectLeftProperty(object context)
diff --git a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs
index 93912b77d..7127bf517 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionListViewModel.cs
@@ -19,7 +19,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
public class DisplayConditionListViewModel : DisplayConditionViewModel
{
private readonly IProfileEditorService _profileEditorService;
- private readonly IDataModelVisualizationService _dataModelVisualizationService;
+ private readonly IDataModelUIService _dataModelUIService;
private readonly IDisplayConditionsVmFactory _displayConditionsVmFactory;
private bool _isInitialized;
private DataModelListViewModel _selectedListProperty;
@@ -30,12 +30,12 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
DisplayConditionList displayConditionList,
DisplayConditionViewModel parent,
IProfileEditorService profileEditorService,
- IDataModelVisualizationService dataModelVisualizationService,
+ IDataModelUIService dataModelUIService,
IDisplayConditionsVmFactory displayConditionsVmFactory,
ISettingsService settingsService) : base(displayConditionList, parent)
{
_profileEditorService = profileEditorService;
- _dataModelVisualizationService = dataModelVisualizationService;
+ _dataModelUIService = dataModelUIService;
_displayConditionsVmFactory = displayConditionsVmFactory;
_updateTimer = new Timer(500);
@@ -111,9 +111,9 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
public void Initialize()
{
// Get the data models
- TargetDataModel = _dataModelVisualizationService.GetMainDataModelVisualization();
- if (!_dataModelVisualizationService.GetPluginExtendsDataModel(_profileEditorService.GetCurrentModule()))
- TargetDataModel.Children.Add(_dataModelVisualizationService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
+ TargetDataModel = _dataModelUIService.GetMainDataModelVisualization();
+ if (!_dataModelUIService.GetPluginExtendsDataModel(_profileEditorService.GetCurrentModule()))
+ TargetDataModel.Children.Add(_dataModelUIService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
TargetDataModel.UpdateRequested += TargetDataModelUpdateRequested;
@@ -135,8 +135,8 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
{
if (TargetDataModelOpen)
{
- TargetDataModel?.Update(_dataModelVisualizationService);
- SelectedListProperty?.Update(_dataModelVisualizationService);
+ TargetDataModel?.Update(_dataModelUIService);
+ SelectedListProperty?.Update(_dataModelUIService);
}
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionPredicateViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionPredicateViewModel.cs
index e1be747ca..f132c696a 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionPredicateViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionPredicateViewModel.cs
@@ -23,7 +23,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
public class DisplayConditionPredicateViewModel : DisplayConditionViewModel, IHandle, IHandle
{
private readonly IDataModelService _dataModelService;
- private readonly IDataModelVisualizationService _dataModelVisualizationService;
+ private readonly IDataModelUIService _dataModelUIService;
private readonly IEventAggregator _eventAggregator;
private readonly IProfileEditorService _profileEditorService;
private bool _isInitialized;
@@ -44,13 +44,13 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
DisplayConditionPredicate displayConditionPredicate,
DisplayConditionViewModel parent,
IProfileEditorService profileEditorService,
- IDataModelVisualizationService dataModelVisualizationService,
+ IDataModelUIService dataModelUIService,
IDataModelService dataModelService,
ISettingsService settingsService,
IEventAggregator eventAggregator) : base(displayConditionPredicate, parent)
{
_profileEditorService = profileEditorService;
- _dataModelVisualizationService = dataModelVisualizationService;
+ _dataModelUIService = dataModelUIService;
_dataModelService = dataModelService;
_eventAggregator = eventAggregator;
_updateTimer = new Timer(500);
@@ -173,16 +173,16 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
public void Initialize()
{
// Get the data models
- LeftSideDataModel = _dataModelVisualizationService.GetMainDataModelVisualization();
- RightSideDataModel = _dataModelVisualizationService.GetMainDataModelVisualization();
- if (!_dataModelVisualizationService.GetPluginExtendsDataModel(_profileEditorService.GetCurrentModule()))
+ LeftSideDataModel = _dataModelUIService.GetMainDataModelVisualization();
+ RightSideDataModel = _dataModelUIService.GetMainDataModelVisualization();
+ if (!_dataModelUIService.GetPluginExtendsDataModel(_profileEditorService.GetCurrentModule()))
{
- LeftSideDataModel.Children.Add(_dataModelVisualizationService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
- RightSideDataModel.Children.Add(_dataModelVisualizationService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
+ LeftSideDataModel.Children.Add(_dataModelUIService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
+ RightSideDataModel.Children.Add(_dataModelUIService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule()));
}
// Determine which types are currently supported
- var editors = _dataModelVisualizationService.RegisteredDataModelEditors;
+ var editors = _dataModelUIService.RegisteredDataModelEditors;
_supportedInputTypes = editors.Select(e => e.SupportedType).ToList();
_supportedInputTypes.AddRange(editors.Where(e => e.CompatibleConversionTypes != null).SelectMany(e => e.CompatibleConversionTypes));
@@ -274,7 +274,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
return;
RightSideTransitionIndex = 1;
- RightSideInputViewModel = _dataModelVisualizationService.GetDataModelInputViewModel(
+ RightSideInputViewModel = _dataModelUIService.GetDataModelInputViewModel(
SelectedLeftSideProperty.PropertyInfo.PropertyType,
SelectedLeftSideProperty.PropertyDescription,
DisplayConditionPredicate.RightStaticValue,
@@ -292,9 +292,9 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
private void OnUpdateTimerOnElapsed(object sender, ElapsedEventArgs e)
{
if (LeftSideDataModelOpen)
- LeftSideDataModel.Update(_dataModelVisualizationService);
+ LeftSideDataModel.Update(_dataModelUIService);
else if (RightSideDataModelOpen)
- RightSideDataModel.Update(_dataModelVisualizationService);
+ RightSideDataModel.Update(_dataModelUIService);
}
private void RightDataModelUpdateRequested(object sender, EventArgs e)
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsTabView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsTabView.xaml
new file mode 100644
index 000000000..7ba15e6eb
--- /dev/null
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsTabView.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsTabViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsTabViewModel.cs
new file mode 100644
index 000000000..1343d0706
--- /dev/null
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsTabViewModel.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using Artemis.Core.Models.Profile.LayerProperties;
+using Stylet;
+
+namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
+{
+ public class DataBindingsTabViewModel : PropertyChangedBase
+ {
+ public DataBindingsTabViewModel(BaseLayerProperty layerProperty, PropertyInfo dataBindingProperty)
+ {
+ DisplayName = dataBindingProperty.Name.ToUpper();
+ LayerProperty = layerProperty;
+ DataBindingProperty = dataBindingProperty;
+ }
+
+ public string DisplayName { get; }
+ public BaseLayerProperty LayerProperty { get; }
+ public PropertyInfo DataBindingProperty { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsView.xaml
new file mode 100644
index 000000000..eea97b713
--- /dev/null
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsView.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsViewModel.cs
new file mode 100644
index 000000000..c2873a44a
--- /dev/null
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingsViewModel.cs
@@ -0,0 +1,25 @@
+using Artemis.Core.Models.Profile.LayerProperties;
+using Stylet;
+
+namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
+{
+ public class DataBindingsViewModel : PropertyChangedBase
+ {
+ public DataBindingsViewModel(BaseLayerProperty layerProperty)
+ {
+ Tabs = new BindableCollection();
+ LayerProperty = layerProperty;
+
+ Initialise();
+ }
+
+ public BindableCollection Tabs { get; set; }
+ public BaseLayerProperty LayerProperty { get; }
+
+ private void Initialise()
+ {
+ foreach (var dataBindingProperty in LayerProperty.GetDataBindingProperties())
+ Tabs.Add(new DataBindingsTabViewModel(LayerProperty, dataBindingProperty));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
index cf14023ad..255e7c213 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
@@ -147,7 +147,7 @@
+ by setting the command target to this hidden button we circumvent that -->
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
_rightSideIndex;
+ set => SetAndNotify(ref _rightSideIndex, value);
+ }
+
public bool PropertyTreeVisible => PropertyTreeIndex == 0;
public RenderProfileElement SelectedProfileElement
@@ -102,7 +111,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
public Layer SelectedLayer => SelectedProfileElement as Layer;
public Folder SelectedFolder => SelectedProfileElement as Folder;
-
+
public BindableCollection LayerPropertyGroups
{
get => _layerPropertyGroups;
@@ -121,6 +130,12 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
set => SetAndNotify(ref _effectsViewModel, value);
}
+ public DataBindingsViewModel DataBindingsViewModel
+ {
+ get => _dataBindingsViewModel;
+ set => SetAndNotify(ref _dataBindingsViewModel, value);
+ }
+
public TimelineViewModel TimelineViewModel
{
get => _timelineViewModel;
@@ -151,6 +166,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
ProfileEditorService.ProfileElementSelected += ProfileEditorServiceOnProfileElementSelected;
ProfileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged;
+ ProfileEditorService.SelectedDataBindingChanged += ProfileEditorServiceOnSelectedDataBindingChanged;
ProfileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged;
base.OnInitialActivate();
@@ -160,6 +176,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
{
ProfileEditorService.ProfileElementSelected -= ProfileEditorServiceOnProfileElementSelected;
ProfileEditorService.CurrentTimeChanged -= ProfileEditorServiceOnCurrentTimeChanged;
+ ProfileEditorService.SelectedDataBindingChanged -= ProfileEditorServiceOnSelectedDataBindingChanged;
ProfileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged;
PopulateProperties(null);
@@ -204,6 +221,19 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
NotifyOfPropertyChange(nameof(TimeCaretPosition));
}
+ private void ProfileEditorServiceOnSelectedDataBindingChanged(object? sender, EventArgs e)
+ {
+ if (ProfileEditorService.SelectedDataBinding != null)
+ {
+ RightSideIndex = 1;
+ DataBindingsViewModel = new DataBindingsViewModel(ProfileEditorService.SelectedDataBinding);
+ } else
+ {
+ RightSideIndex = 0;
+ DataBindingsViewModel = null;
+ }
+ }
+
#region View model managament
public List GetAllLayerPropertyGroupViewModels()
@@ -266,7 +296,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
ApplyLayerBrush();
ApplyEffects();
}
-
+
private void SelectedLayerOnLayerBrushUpdated(object sender, EventArgs e)
{
ApplyLayerBrush();
@@ -599,7 +629,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
#endregion
#region Segments
-
+
public void EnableSegment(string segment)
{
if (segment == "Start")
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyView.xaml
index d54b18d18..f7c2553ff 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyView.xaml
@@ -51,7 +51,8 @@
ToolTip="Change the property's data binding"
Width="24"
Height="24"
- VerticalAlignment="Center">
+ VerticalAlignment="Center"
+ Command="{s:Action OpenDataBindings}">
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs
index 007d08e7a..66fb63562 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs
@@ -37,6 +37,11 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
set => ApplyKeyframesEnabled(value);
}
+ public void OpenDataBindings()
+ {
+ _profileEditorService.ChangeSelectedDataBinding(LayerPropertyViewModel.BaseLayerProperty);
+ }
+
public override void Dispose()
{
PropertyInputViewModel.Dispose();
diff --git a/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugViewModel.cs b/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugViewModel.cs
index 8f29dfd17..f30594cd5 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugViewModel.cs
@@ -5,13 +5,14 @@ using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Shared.DataModelVisualization.Shared;
using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Interfaces;
using Stylet;
namespace Artemis.UI.Screens.Settings.Debug.Tabs
{
public class DataModelDebugViewModel : Screen
{
- private readonly IDataModelVisualizationService _dataModelVisualizationService;
+ private readonly IDataModelUIService _dataModelUIService;
private readonly IPluginService _pluginService;
private readonly Timer _updateTimer;
private bool _isModuleFilterEnabled;
@@ -20,9 +21,9 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
private string _propertySearch;
private Core.Plugins.Modules.Module _selectedModule;
- public DataModelDebugViewModel(IDataModelVisualizationService dataModelVisualizationService, IPluginService pluginService)
+ public DataModelDebugViewModel(IDataModelUIService dataModelUIService, IPluginService pluginService)
{
- _dataModelVisualizationService = dataModelVisualizationService;
+ _dataModelUIService = dataModelUIService;
_pluginService = pluginService;
_updateTimer = new Timer(500);
@@ -92,14 +93,14 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
private void OnUpdateTimerOnElapsed(object sender, ElapsedEventArgs args)
{
- MainDataModel.Update(_dataModelVisualizationService);
+ MainDataModel.Update(_dataModelUIService);
}
private void GetDataModel()
{
MainDataModel = SelectedModule != null
- ? _dataModelVisualizationService.GetPluginDataModelVisualization(SelectedModule)
- : _dataModelVisualizationService.GetMainDataModelVisualization();
+ ? _dataModelUIService.GetPluginDataModelVisualization(SelectedModule)
+ : _dataModelUIService.GetMainDataModelVisualization();
}
private void PluginServiceOnPluginToggled(object? sender, PluginEventArgs e)
diff --git a/src/Artemis.UI/Services/RegistrationService.cs b/src/Artemis.UI/Services/RegistrationService.cs
index b6cc80620..f8445200c 100644
--- a/src/Artemis.UI/Services/RegistrationService.cs
+++ b/src/Artemis.UI/Services/RegistrationService.cs
@@ -10,15 +10,15 @@ namespace Artemis.UI.Services
{
public class RegistrationService : IRegistrationService
{
- private readonly IDataModelVisualizationService _dataModelVisualizationService;
+ private readonly IDataModelUIService _dataModelUIService;
private readonly IProfileEditorService _profileEditorService;
private bool _registeredBuiltInDataModelDisplays;
private bool _registeredBuiltInDataModelInputs;
private bool _registeredBuiltInPropertyEditors;
- public RegistrationService(IDataModelVisualizationService dataModelVisualizationService, IProfileEditorService profileEditorService)
+ public RegistrationService(IDataModelUIService dataModelUIService, IProfileEditorService profileEditorService)
{
- _dataModelVisualizationService = dataModelVisualizationService;
+ _dataModelUIService = dataModelUIService;
_profileEditorService = profileEditorService;
}
@@ -27,7 +27,7 @@ namespace Artemis.UI.Services
if (_registeredBuiltInDataModelDisplays)
return;
- _dataModelVisualizationService.RegisterDataModelDisplay(Constants.CorePluginInfo);
+ _dataModelUIService.RegisterDataModelDisplay(Constants.CorePluginInfo);
_registeredBuiltInDataModelDisplays = true;
}
@@ -37,9 +37,9 @@ namespace Artemis.UI.Services
if (_registeredBuiltInDataModelInputs)
return;
- _dataModelVisualizationService.RegisterDataModelInput(Constants.CorePluginInfo, null);
- _dataModelVisualizationService.RegisterDataModelInput(Constants.CorePluginInfo, Constants.IntegralNumberTypes);
- _dataModelVisualizationService.RegisterDataModelInput(Constants.CorePluginInfo, Constants.FloatNumberTypes);
+ _dataModelUIService.RegisterDataModelInput(Constants.CorePluginInfo, null);
+ _dataModelUIService.RegisterDataModelInput(Constants.CorePluginInfo, Constants.IntegralNumberTypes);
+ _dataModelUIService.RegisterDataModelInput(Constants.CorePluginInfo, Constants.FloatNumberTypes);
_registeredBuiltInDataModelInputs = true;
}