mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Shared UI - Renamed DataModelVisualizationService
Databindings - Started on some basic UI elements
This commit is contained in:
1 parent
2f41b52a03
commit
47ba6fcf5e
31 files changed
+423
-185
No files matched your search
@@ -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