mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Shared UI - Renamed DataModelVisualizationService
Databindings - Started on some basic UI elements
This commit is contained in:
1 parent
babd862b40
commit
a177188ce7
31 files changed
+423
-185
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -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);
|
||||
}
|
||||
|
||||
+4
-3
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
+5
-4
@@ -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
|
||||
/// <summary>
|
||||
/// Updates the datamodel and if in an parent, any children
|
||||
/// </summary>
|
||||
/// <param name="dataModelVisualizationService"></param>
|
||||
public abstract void Update(IDataModelVisualizationService dataModelVisualizationService);
|
||||
/// <param name="dataModelUIService"></param>
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-41
@@ -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<DataModelVisualizationRegistration> _registeredDataModelDisplays;
|
||||
private readonly List<DataModelVisualizationRegistration> _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);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the given plugin expands the main data model
|
||||
/// </summary>
|
||||
/// <param name="plugin"></param>
|
||||
/// <returns></returns>
|
||||
bool GetPluginExtendsDataModel(Plugin plugin);
|
||||
|
||||
DataModelVisualizationRegistration RegisterDataModelInput<T>(PluginInfo pluginInfo, IReadOnlyCollection<Type> compatibleConversionTypes) where T : DataModelInputViewModel;
|
||||
DataModelVisualizationRegistration RegisterDataModelDisplay<T>(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<object, bool> updateCallback);
|
||||
IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelEditors { get; }
|
||||
IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelDisplays { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.Interfaces
|
||||
{
|
||||
public interface IDataBindingUIService : IArtemisSharedUIService
|
||||
{
|
||||
object GetDataBindingViewModel(Type propertyType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Plugins;
|
||||
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
|
||||
using Artemis.UI.Shared.DataModelVisualization;
|
||||
using Artemis.UI.Shared.DataModelVisualization.Shared;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.Interfaces
|
||||
{
|
||||
public interface IDataModelUIService : IArtemisSharedUIService
|
||||
{
|
||||
DataModelPropertiesViewModel GetMainDataModelVisualization();
|
||||
DataModelPropertiesViewModel GetPluginDataModelVisualization(Plugin plugin);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the given plugin expands the main data model
|
||||
/// </summary>
|
||||
/// <param name="plugin"></param>
|
||||
/// <returns></returns>
|
||||
bool GetPluginExtendsDataModel(Plugin plugin);
|
||||
|
||||
DataModelVisualizationRegistration RegisterDataModelInput<T>(PluginInfo pluginInfo, IReadOnlyCollection<Type> compatibleConversionTypes) where T : DataModelInputViewModel;
|
||||
DataModelVisualizationRegistration RegisterDataModelDisplay<T>(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<object, bool> updateCallback);
|
||||
IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelEditors { get; }
|
||||
IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelDisplays { get; }
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,16 @@ namespace Artemis.UI.Shared.Services.Interfaces
|
||||
{
|
||||
Profile SelectedProfile { get; }
|
||||
RenderProfileElement SelectedProfileElement { get; }
|
||||
BaseLayerProperty SelectedDataBinding { get; }
|
||||
TimeSpan CurrentTime { get; set; }
|
||||
int PixelsPerSecond { get; set; }
|
||||
IReadOnlyList<PropertyInputRegistration> RegisteredPropertyEditors { get; }
|
||||
IKernel Kernel { get; }
|
||||
|
||||
void ChangeSelectedProfile(Profile profile);
|
||||
void UpdateSelectedProfile();
|
||||
void ChangeSelectedProfileElement(RenderProfileElement profileElement);
|
||||
void UpdateSelectedProfileElement();
|
||||
void ChangeSelectedDataBinding(BaseLayerProperty layerProperty);
|
||||
void UpdateProfilePreview();
|
||||
bool UndoUpdateProfile();
|
||||
bool RedoUpdateProfile();
|
||||
@@ -48,6 +49,11 @@ namespace Artemis.UI.Shared.Services.Interfaces
|
||||
/// </summary>
|
||||
event EventHandler<RenderProfileElementEventArgs> SelectedProfileElementUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the currently selected data binding layer property is changed
|
||||
/// </summary>
|
||||
event EventHandler SelectedDataBindingChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the current editor time is changed
|
||||
/// </summary>
|
||||
@@ -86,5 +92,5 @@ namespace Artemis.UI.Shared.Services.Interfaces
|
||||
/// <param name="excludedKeyframe">A keyframe to exclude during keyframe snapping</param>
|
||||
/// <returns></returns>
|
||||
TimeSpan SnapToTimeline(TimeSpan time, TimeSpan tolerance, bool snapToSegments, bool snapToCurrentTime, bool snapToKeyframes, BaseLayerPropertyKeyframe excludedKeyframe = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ namespace Artemis.UI.Shared.Services
|
||||
public IReadOnlyList<PropertyInputRegistration> 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<ProfileEventArgs> SelectedProfileUpdated;
|
||||
public event EventHandler<RenderProfileElementEventArgs> ProfileElementSelected;
|
||||
public event EventHandler<RenderProfileElementEventArgs> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user