mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-01 02:03:32 +00:00
Profile editor - Continue updating datamodel in editor
Display conditions - Added setting to display current values while selecting condition targets
This commit is contained in:
parent
8ca671fa84
commit
c5dbe73000
@ -25,6 +25,7 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
{
|
{
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
DisplayConditionPredicateEntity = entity;
|
DisplayConditionPredicateEntity = entity;
|
||||||
|
PredicateType = (PredicateType) entity.PredicateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisplayConditionPredicateEntity DisplayConditionPredicateEntity { get; set; }
|
public DisplayConditionPredicateEntity DisplayConditionPredicateEntity { get; set; }
|
||||||
@ -124,6 +125,9 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
StaticConditionLambda = null;
|
StaticConditionLambda = null;
|
||||||
CompiledStaticConditionLambda = null;
|
CompiledStaticConditionLambda = null;
|
||||||
|
|
||||||
|
if (Operator == null)
|
||||||
|
return;
|
||||||
|
|
||||||
// If the operator does not support a right side, create a static expression because the right side will simply be null
|
// If the operator does not support a right side, create a static expression because the right side will simply be null
|
||||||
if (PredicateType == PredicateType.Dynamic && Operator.SupportsRightSide)
|
if (PredicateType == PredicateType.Dynamic && Operator.SupportsRightSide)
|
||||||
CreateDynamicExpression();
|
CreateDynamicExpression();
|
||||||
@ -133,6 +137,7 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
|
|
||||||
internal override void ApplyToEntity()
|
internal override void ApplyToEntity()
|
||||||
{
|
{
|
||||||
|
DisplayConditionPredicateEntity.PredicateType = (int)PredicateType;
|
||||||
DisplayConditionPredicateEntity.LeftDataModelGuid = LeftDataModel?.PluginInfo?.Guid;
|
DisplayConditionPredicateEntity.LeftDataModelGuid = LeftDataModel?.PluginInfo?.Guid;
|
||||||
DisplayConditionPredicateEntity.LeftPropertyPath = LeftPropertyPath;
|
DisplayConditionPredicateEntity.LeftPropertyPath = LeftPropertyPath;
|
||||||
|
|
||||||
@ -173,14 +178,14 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Right side dynamic
|
// Right side dynamic
|
||||||
if (DisplayConditionPredicateEntity.RightDataModelGuid != null)
|
if (PredicateType == PredicateType.Dynamic && DisplayConditionPredicateEntity.RightDataModelGuid != null)
|
||||||
{
|
{
|
||||||
var dataModel = dataModelService.GetPluginDataModelByGuid(DisplayConditionPredicateEntity.RightDataModelGuid.Value);
|
var dataModel = dataModelService.GetPluginDataModelByGuid(DisplayConditionPredicateEntity.RightDataModelGuid.Value);
|
||||||
if (dataModel != null && dataModel.ContainsPath(DisplayConditionPredicateEntity.RightPropertyPath))
|
if (dataModel != null && dataModel.ContainsPath(DisplayConditionPredicateEntity.RightPropertyPath))
|
||||||
UpdateRightSide(dataModel, DisplayConditionPredicateEntity.RightPropertyPath);
|
UpdateRightSide(dataModel, DisplayConditionPredicateEntity.RightPropertyPath);
|
||||||
}
|
}
|
||||||
// Right side static
|
// Right side static
|
||||||
else if (DisplayConditionPredicateEntity.RightStaticValue != null)
|
else if (PredicateType == PredicateType.Static && DisplayConditionPredicateEntity.RightStaticValue != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -188,7 +193,20 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
{
|
{
|
||||||
// Use the left side type so JSON.NET has a better idea what to do
|
// Use the left side type so JSON.NET has a better idea what to do
|
||||||
var leftSideType = LeftDataModel.GetTypeAtPath(LeftPropertyPath);
|
var leftSideType = LeftDataModel.GetTypeAtPath(LeftPropertyPath);
|
||||||
UpdateRightSide(JsonConvert.DeserializeObject(DisplayConditionPredicateEntity.RightStaticValue, leftSideType));
|
object rightSideValue;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
rightSideValue = JsonConvert.DeserializeObject(DisplayConditionPredicateEntity.RightStaticValue, leftSideType);
|
||||||
|
}
|
||||||
|
// If deserialization fails, use the type's default
|
||||||
|
catch (JsonSerializationException e)
|
||||||
|
{
|
||||||
|
dataModelService.LogDeserializationFailure(this, e);
|
||||||
|
rightSideValue = Activator.CreateInstance(leftSideType);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateRightSide(rightSideValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -265,7 +283,7 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
|
|
||||||
private void CreateDynamicExpression()
|
private void CreateDynamicExpression()
|
||||||
{
|
{
|
||||||
if (LeftDataModel == null || RightDataModel == null)
|
if (LeftDataModel == null || RightDataModel == null || Operator == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var leftSideParameter = Expression.Parameter(typeof(DataModel), "leftDataModel");
|
var leftSideParameter = Expression.Parameter(typeof(DataModel), "leftDataModel");
|
||||||
@ -306,8 +324,8 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// If the right side value is null, the constant type cannot be inferred and must be provided manually
|
// If the right side value is null, the constant type cannot be inferred and must be provided manually
|
||||||
var rightSideConstant = RightStaticValue != null
|
var rightSideConstant = RightStaticValue != null
|
||||||
? Expression.Constant(RightStaticValue)
|
? Expression.Constant(RightStaticValue)
|
||||||
: Expression.Constant(null, leftSideAccessor.Type);
|
: Expression.Constant(null, leftSideAccessor.Type);
|
||||||
|
|
||||||
var conditionExpression = Operator.CreateExpression(leftSideAccessor, rightSideConstant);
|
var conditionExpression = Operator.CreateExpression(leftSideAccessor, rightSideConstant);
|
||||||
@ -315,6 +333,13 @@ namespace Artemis.Core.Models.Profile.Conditions
|
|||||||
StaticConditionLambda = Expression.Lambda<Func<DataModel, bool>>(conditionExpression, leftSideParameter);
|
StaticConditionLambda = Expression.Lambda<Func<DataModel, bool>>(conditionExpression, leftSideParameter);
|
||||||
CompiledStaticConditionLambda = StaticConditionLambda.Compile();
|
CompiledStaticConditionLambda = StaticConditionLambda.Compile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (PredicateType == PredicateType.Dynamic)
|
||||||
|
return $"[Dynamic] {LeftPropertyPath} {Operator.Description} {RightPropertyPath}";
|
||||||
|
return $"[Static] {LeftPropertyPath} {Operator.Description} {RightStaticValue}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PredicateType
|
public enum PredicateType
|
||||||
|
|||||||
@ -223,12 +223,14 @@ namespace Artemis.Core.Models.Profile
|
|||||||
// Ensure the layer must still be displayed
|
// Ensure the layer must still be displayed
|
||||||
UpdateDisplayCondition();
|
UpdateDisplayCondition();
|
||||||
|
|
||||||
// TODO: No point updating further than this if the layer is not going to be rendered
|
|
||||||
|
|
||||||
// Update the layer timeline, this will give us a new delta time which could be negative in case the main segment wrapped back
|
// Update the layer timeline, this will give us a new delta time which could be negative in case the main segment wrapped back
|
||||||
// to it's start
|
// to it's start
|
||||||
UpdateTimeline(deltaTime);
|
UpdateTimeline(deltaTime);
|
||||||
|
|
||||||
|
// No point updating further than this if the layer is not going to be rendered
|
||||||
|
if (TimelinePosition > TimelineLength)
|
||||||
|
return;
|
||||||
|
|
||||||
General.Update();
|
General.Update();
|
||||||
Transform.Update();
|
Transform.Update();
|
||||||
LayerBrush.BaseProperties?.Update();
|
LayerBrush.BaseProperties?.Update();
|
||||||
@ -285,7 +287,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Render(double deltaTime, SKCanvas canvas, SKImageInfo canvasInfo)
|
public override void Render(double deltaTime, SKCanvas canvas, SKImageInfo canvasInfo)
|
||||||
{
|
{
|
||||||
if (!Enabled)
|
if (!Enabled || TimelinePosition > TimelineLength)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Ensure the layer is ready
|
// Ensure the layer is ready
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Reflection;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||||
|
using Artemis.Core.Utilities;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.Abstract
|
namespace Artemis.Core.Plugins.Abstract
|
||||||
{
|
{
|
||||||
@ -18,6 +24,27 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
internal set => InternalDataModel = value;
|
internal set => InternalDataModel = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hide the provided property using a lambda expression, e.g. HideProperty(dm => dm.TimeDataModel.CurrentTimeUTC)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertyLambda">A lambda expression pointing to the property to ignore</param>
|
||||||
|
public void HideProperty<TProperty>(Expression<Func<T, TProperty>> propertyLambda)
|
||||||
|
{
|
||||||
|
var propertyInfo = ReflectionUtilities.GetPropertyInfo(DataModel, propertyLambda);
|
||||||
|
if (!HiddenPropertiesList.Any(p => p.Equals(propertyInfo)))
|
||||||
|
HiddenPropertiesList.Add(propertyInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop hiding the provided property using a lambda expression, e.g. ShowProperty(dm => dm.TimeDataModel.CurrentTimeUTC)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertyLambda">A lambda expression pointing to the property to stop ignoring</param>
|
||||||
|
public void ShowProperty<TProperty>(Expression<Func<T, TProperty>> propertyLambda)
|
||||||
|
{
|
||||||
|
var propertyInfo = ReflectionUtilities.GetPropertyInfo(DataModel, propertyLambda);
|
||||||
|
HiddenPropertiesList.RemoveAll(p => p.Equals(propertyInfo));
|
||||||
|
}
|
||||||
|
|
||||||
internal override void InternalEnablePlugin()
|
internal override void InternalEnablePlugin()
|
||||||
{
|
{
|
||||||
DataModel = Activator.CreateInstance<T>();
|
DataModel = Activator.CreateInstance<T>();
|
||||||
@ -39,6 +66,13 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseDataModelExpansion : Plugin
|
public abstract class BaseDataModelExpansion : Plugin
|
||||||
{
|
{
|
||||||
|
protected readonly List<PropertyInfo> HiddenPropertiesList = new List<PropertyInfo>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
|
||||||
|
/// </summary>
|
||||||
|
public ReadOnlyCollection<PropertyInfo> HiddenProperties => HiddenPropertiesList.AsReadOnly();
|
||||||
|
|
||||||
internal DataModel InternalDataModel { get; set; }
|
internal DataModel InternalDataModel { get; set; }
|
||||||
public abstract void Update(double deltaTime);
|
public abstract void Update(double deltaTime);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Reflection;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
|
|
||||||
@ -51,5 +54,19 @@ namespace Artemis.Core.Plugins.Abstract.DataModels
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a read-only list of all properties in this datamodel that are to be ignored
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReadOnlyCollection<PropertyInfo> GetHiddenProperties()
|
||||||
|
{
|
||||||
|
if (PluginInfo.Instance is ProfileModule profileModule)
|
||||||
|
return profileModule.HiddenProperties;
|
||||||
|
if (PluginInfo.Instance is BaseDataModelExpansion dataModelExpansion)
|
||||||
|
return dataModelExpansion.HiddenProperties;
|
||||||
|
|
||||||
|
return new List<PropertyInfo>().AsReadOnly();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called each frame when the module must update
|
/// Called each frame when the module must update
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deltaTime">Time since the last update</param>
|
/// <param name="deltaTime">Time in seconds since the last update</param>
|
||||||
public abstract void Update(double deltaTime);
|
public abstract void Update(double deltaTime);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,16 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Reflection;
|
||||||
using Artemis.Core.Exceptions;
|
using Artemis.Core.Exceptions;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Surface;
|
using Artemis.Core.Models.Surface;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Utilities;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.Abstract
|
namespace Artemis.Core.Plugins.Abstract
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows you to add support for new games/applications while utilizing Artemis' profile engine and your own data model
|
/// Allows you to add support for new games/applications while utilizing Artemis' profile engine and your own data
|
||||||
|
/// model
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ProfileModule<T> : ProfileModule where T : DataModel
|
public abstract class ProfileModule<T> : ProfileModule where T : DataModel
|
||||||
{
|
{
|
||||||
@ -45,7 +51,29 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
{
|
{
|
||||||
return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description};
|
return new DataModelPropertyAttribute {Name = PluginInfo.Name, Description = PluginInfo.Description};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hide the provided property using a lambda expression, e.g. HideProperty(dm => dm.TimeDataModel.CurrentTimeUTC)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertyLambda">A lambda expression pointing to the property to ignore</param>
|
||||||
|
public void HideProperty<TProperty>(Expression<Func<T, TProperty>> propertyLambda)
|
||||||
|
{
|
||||||
|
var propertyInfo = ReflectionUtilities.GetPropertyInfo(DataModel, propertyLambda);
|
||||||
|
if (!HiddenPropertiesList.Any(p => p.Equals(propertyInfo)))
|
||||||
|
HiddenPropertiesList.Add(propertyInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop hiding the provided property using a lambda expression, e.g. ShowProperty(dm =>
|
||||||
|
/// dm.TimeDataModel.CurrentTimeUTC)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertyLambda">A lambda expression pointing to the property to stop ignoring</param>
|
||||||
|
public void ShowProperty<TProperty>(Expression<Func<T, TProperty>> propertyLambda)
|
||||||
|
{
|
||||||
|
var propertyInfo = ReflectionUtilities.GetPropertyInfo(DataModel, propertyLambda);
|
||||||
|
HiddenPropertiesList.RemoveAll(p => p.Equals(propertyInfo));
|
||||||
|
}
|
||||||
|
|
||||||
internal override void InternalEnablePlugin()
|
internal override void InternalEnablePlugin()
|
||||||
{
|
{
|
||||||
DataModel = Activator.CreateInstance<T>();
|
DataModel = Activator.CreateInstance<T>();
|
||||||
@ -66,15 +94,28 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ProfileModule : Module
|
public abstract class ProfileModule : Module
|
||||||
{
|
{
|
||||||
|
protected readonly List<PropertyInfo> HiddenPropertiesList = new List<PropertyInfo>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
|
||||||
|
/// </summary>
|
||||||
|
public ReadOnlyCollection<PropertyInfo> HiddenProperties => HiddenPropertiesList.AsReadOnly();
|
||||||
|
|
||||||
public Profile ActiveProfile { get; private set; }
|
public Profile ActiveProfile { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disables updating the profile, rendering does continue
|
||||||
|
/// </summary>
|
||||||
|
public bool IsProfileUpdatingDisabled { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
// Update the profile
|
// Update the profile
|
||||||
ActiveProfile?.Update(deltaTime);
|
if (!IsProfileUpdatingDisabled)
|
||||||
|
ActiveProfile?.Update(deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,14 +2,25 @@
|
|||||||
|
|
||||||
namespace Artemis.Core.Plugins.Abstract.ViewModels
|
namespace Artemis.Core.Plugins.Abstract.ViewModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The base class for any view model that belongs to a module
|
||||||
|
/// </summary>
|
||||||
public abstract class ModuleViewModel : Screen
|
public abstract class ModuleViewModel : Screen
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The base class for any view model that belongs to a module
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="module">The module this view model belongs to</param>
|
||||||
|
/// <param name="displayName">The name of the tab that's shown on the modules UI page</param>
|
||||||
protected ModuleViewModel(Module module, string displayName)
|
protected ModuleViewModel(Module module, string displayName)
|
||||||
{
|
{
|
||||||
Module = module;
|
Module = module;
|
||||||
DisplayName = displayName;
|
DisplayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the module this view model belongs to
|
||||||
|
/// </summary>
|
||||||
public Module Module { get; }
|
public Module Module { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,7 +60,6 @@ namespace Artemis.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TimeSpan FrameTime { get; private set; }
|
public TimeSpan FrameTime { get; private set; }
|
||||||
public bool PluginUpdatingDisabled { get; set; }
|
|
||||||
public bool ModuleRenderingDisabled { get; set; }
|
public bool ModuleRenderingDisabled { get; set; }
|
||||||
public List<string> StartupArguments { get; set; }
|
public List<string> StartupArguments { get; set; }
|
||||||
|
|
||||||
@ -140,21 +139,18 @@ namespace Artemis.Core.Services
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_frameStopWatch.Restart();
|
_frameStopWatch.Restart();
|
||||||
if (!PluginUpdatingDisabled)
|
lock (_dataModelExpansions)
|
||||||
{
|
{
|
||||||
lock (_dataModelExpansions)
|
// Update all active modules
|
||||||
{
|
foreach (var dataModelExpansion in _dataModelExpansions)
|
||||||
// Update all active modules
|
dataModelExpansion.Update(args.DeltaTime);
|
||||||
foreach (var dataModelExpansion in _dataModelExpansions)
|
}
|
||||||
dataModelExpansion.Update(args.DeltaTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (_modules)
|
lock (_modules)
|
||||||
{
|
{
|
||||||
// Update all active modules
|
// Update all active modules
|
||||||
foreach (var module in _modules)
|
foreach (var module in _modules)
|
||||||
module.Update(args.DeltaTime);
|
module.Update(args.DeltaTime);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is no ready bitmap brush, skip the frame
|
// If there is no ready bitmap brush, skip the frame
|
||||||
|
|||||||
@ -12,6 +12,8 @@ using Artemis.Core.Plugins.Abstract.DataModels;
|
|||||||
using Artemis.Core.Plugins.Exceptions;
|
using Artemis.Core.Plugins.Exceptions;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace Artemis.Core.Services
|
namespace Artemis.Core.Services
|
||||||
{
|
{
|
||||||
@ -22,11 +24,13 @@ namespace Artemis.Core.Services
|
|||||||
{
|
{
|
||||||
private readonly List<DataModel> _dataModelExpansions;
|
private readonly List<DataModel> _dataModelExpansions;
|
||||||
private readonly IPluginService _pluginService;
|
private readonly IPluginService _pluginService;
|
||||||
|
private readonly ILogger _logger;
|
||||||
private readonly List<DisplayConditionOperator> _registeredConditionOperators;
|
private readonly List<DisplayConditionOperator> _registeredConditionOperators;
|
||||||
|
|
||||||
internal DataModelService(IPluginService pluginService)
|
internal DataModelService(IPluginService pluginService, ILogger logger)
|
||||||
{
|
{
|
||||||
_pluginService = pluginService;
|
_pluginService = pluginService;
|
||||||
|
_logger = logger;
|
||||||
_dataModelExpansions = new List<DataModel>();
|
_dataModelExpansions = new List<DataModel>();
|
||||||
_registeredConditionOperators = new List<DisplayConditionOperator>();
|
_registeredConditionOperators = new List<DisplayConditionOperator>();
|
||||||
|
|
||||||
@ -174,6 +178,11 @@ namespace Artemis.Core.Services
|
|||||||
return RegisteredConditionOperators.FirstOrDefault(o => o.PluginInfo.Guid == operatorPluginGuid && o.GetType().Name == operatorType);
|
return RegisteredConditionOperators.FirstOrDefault(o => o.PluginInfo.Guid == operatorPluginGuid && o.GetType().Name == operatorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LogDeserializationFailure(DisplayConditionPredicate displayConditionPredicate, JsonSerializationException exception)
|
||||||
|
{
|
||||||
|
_logger.Warning(exception, "Failed to deserialize display condition predicate {predicate}", displayConditionPredicate);
|
||||||
|
}
|
||||||
|
|
||||||
private void RegisterBuiltInConditionOperators()
|
private void RegisterBuiltInConditionOperators()
|
||||||
{
|
{
|
||||||
// General usage for any type
|
// General usage for any type
|
||||||
|
|||||||
@ -15,12 +15,7 @@ namespace Artemis.Core.Services.Interfaces
|
|||||||
/// The time the last frame took to render
|
/// The time the last frame took to render
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TimeSpan FrameTime { get; }
|
TimeSpan FrameTime { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets whether modules are updated each frame by calling their Update method
|
|
||||||
/// </summary>
|
|
||||||
bool PluginUpdatingDisabled { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets whether modules are rendered each frame by calling their Render method
|
/// Gets or sets whether modules are rendered each frame by calling their Render method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Artemis.Core.Models.Profile.Conditions;
|
|||||||
using Artemis.Core.Plugins.Abstract;
|
using Artemis.Core.Plugins.Abstract;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Artemis.Core.Services.Interfaces
|
namespace Artemis.Core.Services.Interfaces
|
||||||
{
|
{
|
||||||
@ -59,5 +60,6 @@ namespace Artemis.Core.Services.Interfaces
|
|||||||
|
|
||||||
List<DisplayConditionOperator> GetCompatibleConditionOperators(Type type);
|
List<DisplayConditionOperator> GetCompatibleConditionOperators(Type type);
|
||||||
DisplayConditionOperator GetConditionOperator(Guid operatorPluginGuid, string operatorType);
|
DisplayConditionOperator GetConditionOperator(Guid operatorPluginGuid, string operatorType);
|
||||||
|
void LogDeserializationFailure(DisplayConditionPredicate displayConditionPredicate, JsonSerializationException exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
24
src/Artemis.Core/Utilities/ReflectionUtilities.cs
Normal file
24
src/Artemis.Core/Utilities/ReflectionUtilities.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Artemis.Core.Utilities
|
||||||
|
{
|
||||||
|
public static class ReflectionUtilities
|
||||||
|
{
|
||||||
|
public static PropertyInfo GetPropertyInfo<TSource, TProperty>(TSource source, Expression<Func<TSource, TProperty>> propertyLambda)
|
||||||
|
{
|
||||||
|
var type = typeof(TSource);
|
||||||
|
|
||||||
|
var member = propertyLambda.Body as MemberExpression;
|
||||||
|
if (member == null)
|
||||||
|
throw new ArgumentException(string.Format("Expression '{0}' refers to a method, not a property.", propertyLambda));
|
||||||
|
|
||||||
|
var propInfo = member.Member as PropertyInfo;
|
||||||
|
if (propInfo == null)
|
||||||
|
throw new ArgumentException(string.Format("Expression '{0}' refers to a field, not a property.", propertyLambda));
|
||||||
|
|
||||||
|
return propInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@ namespace Artemis.Storage.Entities.Profile
|
|||||||
{
|
{
|
||||||
public class DisplayConditionPredicateEntity : DisplayConditionPartEntity
|
public class DisplayConditionPredicateEntity : DisplayConditionPartEntity
|
||||||
{
|
{
|
||||||
|
public int PredicateType { get; set; }
|
||||||
public Guid? LeftDataModelGuid { get; set; }
|
public Guid? LeftDataModelGuid { get; set; }
|
||||||
public string LeftPropertyPath { get; set; }
|
public string LeftPropertyPath { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||||
using Artemis.UI.Shared.Services;
|
using Artemis.UI.Shared.Services;
|
||||||
@ -31,16 +32,29 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
|||||||
|
|
||||||
private void PopulateProperties(IDataModelVisualizationService dataModelVisualizationService)
|
private void PopulateProperties(IDataModelVisualizationService dataModelVisualizationService)
|
||||||
{
|
{
|
||||||
if (Children.Any())
|
if (IsRootViewModel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Add missing children
|
||||||
var modelType = Parent.IsRootViewModel ? DataModel.GetType() : PropertyInfo.PropertyType;
|
var modelType = Parent.IsRootViewModel ? DataModel.GetType() : PropertyInfo.PropertyType;
|
||||||
foreach (var propertyInfo in modelType.GetProperties())
|
foreach (var propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||||
{
|
{
|
||||||
|
if (Children.Any(c => c.PropertyInfo.Equals(propertyInfo)))
|
||||||
|
continue;
|
||||||
|
|
||||||
var child = CreateChild(dataModelVisualizationService, propertyInfo, GetChildDepth());
|
var child = CreateChild(dataModelVisualizationService, propertyInfo, GetChildDepth());
|
||||||
if (child != null)
|
if (child != null)
|
||||||
Children.Add(child);
|
Children.Add(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove children that should be hidden
|
||||||
|
var childList = new List<DataModelVisualizationViewModel>(Children);
|
||||||
|
var hiddenProperties = DataModel.GetHiddenProperties();
|
||||||
|
foreach (var dataModelVisualizationViewModel in childList)
|
||||||
|
{
|
||||||
|
if (hiddenProperties.Contains(dataModelVisualizationViewModel.PropertyInfo))
|
||||||
|
Children.Remove(dataModelVisualizationViewModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int GetChildDepth()
|
protected int GetChildDepth()
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Artemis.Core.Extensions;
|
using Artemis.Core.Extensions;
|
||||||
using Artemis.Core.Models.Profile.Conditions;
|
using Artemis.Core.Models.Profile.Conditions;
|
||||||
|
using Artemis.Core.Plugins.Abstract;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||||
using Artemis.UI.Shared.Exceptions;
|
using Artemis.UI.Shared.Exceptions;
|
||||||
@ -23,6 +26,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
|||||||
private DataModelVisualizationViewModel _parent;
|
private DataModelVisualizationViewModel _parent;
|
||||||
private DataModelPropertyAttribute _propertyDescription;
|
private DataModelPropertyAttribute _propertyDescription;
|
||||||
private PropertyInfo _propertyInfo;
|
private PropertyInfo _propertyInfo;
|
||||||
|
private bool _isIgnored;
|
||||||
|
|
||||||
internal DataModelVisualizationViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, PropertyInfo propertyInfo)
|
internal DataModelVisualizationViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, PropertyInfo propertyInfo)
|
||||||
{
|
{
|
||||||
@ -31,7 +35,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
|||||||
Parent = parent;
|
Parent = parent;
|
||||||
Children = new BindableCollection<DataModelVisualizationViewModel>();
|
Children = new BindableCollection<DataModelVisualizationViewModel>();
|
||||||
IsMatchingFilteredTypes = true;
|
IsMatchingFilteredTypes = true;
|
||||||
|
|
||||||
if (dataModel == null && parent == null && propertyInfo == null)
|
if (dataModel == null && parent == null && propertyInfo == null)
|
||||||
IsRootViewModel = true;
|
IsRootViewModel = true;
|
||||||
else
|
else
|
||||||
@ -118,7 +122,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the datamodel and if in an parent, any children
|
/// Updates the datamodel and if in an parent, any children
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataModelVisualizationService"></param>
|
/// <param name="dataModelVisualizationService"></param>
|
||||||
public abstract void Update(IDataModelVisualizationService dataModelVisualizationService);
|
public abstract void Update(IDataModelVisualizationService dataModelVisualizationService);
|
||||||
@ -231,6 +235,9 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
|||||||
// Skip properties decorated with DataModelIgnore
|
// Skip properties decorated with DataModelIgnore
|
||||||
if (Attribute.IsDefined(propertyInfo, typeof(DataModelIgnoreAttribute)))
|
if (Attribute.IsDefined(propertyInfo, typeof(DataModelIgnoreAttribute)))
|
||||||
return null;
|
return null;
|
||||||
|
// Skip properties that are in the ignored properties list of the respective profile module/data model expansion
|
||||||
|
if (DataModel.GetHiddenProperties().Any(p => p.Equals(propertyInfo)))
|
||||||
|
return null;
|
||||||
|
|
||||||
// If a display VM was found, prefer to use that in any case
|
// If a display VM was found, prefer to use that in any case
|
||||||
var typeViewModel = dataModelVisualizationService.GetDataModelDisplayViewModel(propertyInfo.PropertyType);
|
var typeViewModel = dataModelVisualizationService.GetDataModelDisplayViewModel(propertyInfo.PropertyType);
|
||||||
@ -248,17 +255,6 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Events
|
|
||||||
|
|
||||||
public event EventHandler UpdateRequested;
|
|
||||||
|
|
||||||
protected virtual void OnUpdateRequested()
|
|
||||||
{
|
|
||||||
UpdateRequested?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private void RequestUpdate()
|
private void RequestUpdate()
|
||||||
{
|
{
|
||||||
Parent?.RequestUpdate();
|
Parent?.RequestUpdate();
|
||||||
@ -283,6 +279,17 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
|||||||
if (PropertyDescription != null && PropertyDescription.Name == null && PropertyInfo != null)
|
if (PropertyDescription != null && PropertyDescription.Name == null && PropertyInfo != null)
|
||||||
PropertyDescription.Name = PropertyInfo.Name.Humanize();
|
PropertyDescription.Name = PropertyInfo.Name.Humanize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
|
||||||
|
public event EventHandler UpdateRequested;
|
||||||
|
|
||||||
|
protected virtual void OnUpdateRequested()
|
||||||
|
{
|
||||||
|
UpdateRequested?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DisplayConditionSide
|
public enum DisplayConditionSide
|
||||||
|
|||||||
@ -26,8 +26,6 @@ namespace Artemis.UI.Shared.Services.Interfaces
|
|||||||
void UpdateProfilePreview();
|
void UpdateProfilePreview();
|
||||||
void UndoUpdateProfile(ProfileModule module);
|
void UndoUpdateProfile(ProfileModule module);
|
||||||
void RedoUpdateProfile(ProfileModule module);
|
void RedoUpdateProfile(ProfileModule module);
|
||||||
void StopRegularRender();
|
|
||||||
void ResumeRegularRender();
|
|
||||||
Module GetCurrentModule();
|
Module GetCurrentModule();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
using Artemis.Core.Models.Profile.LayerProperties;
|
||||||
using Artemis.Core.Plugins.Abstract;
|
using Artemis.Core.Plugins.Abstract;
|
||||||
using Artemis.Core.Plugins.Exceptions;
|
using Artemis.Core.Plugins.Exceptions;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services.Interfaces;
|
|
||||||
using Artemis.Core.Services.Storage.Interfaces;
|
using Artemis.Core.Services.Storage.Interfaces;
|
||||||
using Artemis.UI.Shared.Events;
|
using Artemis.UI.Shared.Events;
|
||||||
using Artemis.UI.Shared.PropertyInput;
|
using Artemis.UI.Shared.PropertyInput;
|
||||||
@ -19,18 +17,16 @@ namespace Artemis.UI.Shared.Services
|
|||||||
{
|
{
|
||||||
public class ProfileEditorService : IProfileEditorService
|
public class ProfileEditorService : IProfileEditorService
|
||||||
{
|
{
|
||||||
private readonly ICoreService _coreService;
|
|
||||||
private readonly IProfileService _profileService;
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
private readonly IProfileService _profileService;
|
||||||
private readonly List<PropertyInputRegistration> _registeredPropertyEditors;
|
private readonly List<PropertyInputRegistration> _registeredPropertyEditors;
|
||||||
private TimeSpan _currentTime;
|
private TimeSpan _currentTime;
|
||||||
private int _pixelsPerSecond;
|
private int _pixelsPerSecond;
|
||||||
private object _selectedProfileLock = new object();
|
private readonly object _selectedProfileElementLock = new object();
|
||||||
private object _selectedProfileElementLock = new object();
|
private readonly object _selectedProfileLock = new object();
|
||||||
|
|
||||||
public ProfileEditorService(ICoreService coreService, IProfileService profileService, IKernel kernel, ILogger logger)
|
public ProfileEditorService(IProfileService profileService, IKernel kernel, ILogger logger)
|
||||||
{
|
{
|
||||||
_coreService = coreService;
|
|
||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_registeredPropertyEditors = new List<PropertyInputRegistration>();
|
_registeredPropertyEditors = new List<PropertyInputRegistration>();
|
||||||
@ -126,7 +122,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
{
|
{
|
||||||
if (SelectedProfile == null)
|
if (SelectedProfile == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Stick to the main segment for any element that is not currently selected
|
// Stick to the main segment for any element that is not currently selected
|
||||||
foreach (var folder in SelectedProfile.GetAllFolders())
|
foreach (var folder in SelectedProfile.GetAllFolders())
|
||||||
folder.OverrideProgress(CurrentTime, folder != SelectedProfileElement);
|
folder.OverrideProgress(CurrentTime, folder != SelectedProfileElement);
|
||||||
@ -260,19 +256,9 @@ namespace Artemis.UI.Shared.Services
|
|||||||
public event EventHandler<RenderProfileElementEventArgs> ProfileElementSelected;
|
public event EventHandler<RenderProfileElementEventArgs> ProfileElementSelected;
|
||||||
public event EventHandler<RenderProfileElementEventArgs> SelectedProfileElementUpdated;
|
public event EventHandler<RenderProfileElementEventArgs> SelectedProfileElementUpdated;
|
||||||
public event EventHandler CurrentTimeChanged;
|
public event EventHandler CurrentTimeChanged;
|
||||||
public event EventHandler CurrentTimelineChanged;
|
|
||||||
public event EventHandler PixelsPerSecondChanged;
|
public event EventHandler PixelsPerSecondChanged;
|
||||||
public event EventHandler ProfilePreviewUpdated;
|
public event EventHandler ProfilePreviewUpdated;
|
||||||
|
public event EventHandler CurrentTimelineChanged;
|
||||||
public void StopRegularRender()
|
|
||||||
{
|
|
||||||
_coreService.PluginUpdatingDisabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResumeRegularRender()
|
|
||||||
{
|
|
||||||
_coreService.PluginUpdatingDisabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSelectedProfileChanged(ProfileEventArgs e)
|
protected virtual void OnSelectedProfileChanged(ProfileEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:converters="clr-namespace:Artemis.UI.Converters"
|
xmlns:converters="clr-namespace:Artemis.UI.Converters"
|
||||||
xmlns:utilities="clr-namespace:Artemis.UI.Utilities"
|
xmlns:utilities="clr-namespace:Artemis.UI.Utilities"
|
||||||
|
xmlns:dataModel="clr-namespace:Artemis.UI.Shared.DataModelVisualization.Shared;assembly=Artemis.UI.Shared"
|
||||||
x:Class="Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions.DisplayConditionPredicateView"
|
x:Class="Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions.DisplayConditionPredicateView"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
@ -20,6 +21,47 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
||||||
<utilities:BindingProxy x:Key="DataContextProxy" Data="{Binding}" />
|
<utilities:BindingProxy x:Key="DataContextProxy" Data="{Binding}" />
|
||||||
|
<DataTemplate x:Key="DataModelSelectionTemplate">
|
||||||
|
<StackPanel>
|
||||||
|
<StackPanel.Resources>
|
||||||
|
<DataTemplate DataType="{x:Type dataModel:DataModelPropertiesViewModel}">
|
||||||
|
<TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
|
||||||
|
<Grid ToolTip="{Binding PropertyDescription.Description}">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- Value description -->
|
||||||
|
<TextBlock Grid.Column="0" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
|
||||||
|
|
||||||
|
<!-- Value display -->
|
||||||
|
<StackPanel Grid.Column="1" Visibility="{Binding Data.ShowDataModelValues.Value, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay, Source={StaticResource DataContextProxy}}">
|
||||||
|
<TextBlock Text="{Binding DisplayValue, Mode=OneWay}"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Visibility="{Binding ShowToString, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
|
||||||
|
Margin="15 0.5 0 0" />
|
||||||
|
<TextBlock Text="null"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}"
|
||||||
|
Margin="15 0.5 0 0"
|
||||||
|
Visibility="{Binding ShowNull, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||||
|
<ContentControl s:View.Model="{Binding DisplayViewModel}"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
Margin="15 0.5 0 0"
|
||||||
|
Visibility="{Binding ShowViewModel, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</StackPanel.Resources>
|
||||||
|
<ContentPresenter Content="{Binding}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@ -55,13 +97,12 @@
|
|||||||
<ContextMenu.ItemContainerStyle>
|
<ContextMenu.ItemContainerStyle>
|
||||||
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
|
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
|
||||||
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
||||||
<Setter Property="Header" Value="{Binding PropertyDescription.Name}" />
|
|
||||||
<Setter Property="ToolTip" Value="{Binding PropertyDescription.Description}" />
|
|
||||||
<Setter Property="Command" Value="{Binding Data.SelectLeftPropertyCommand, Source={StaticResource DataContextProxy}}" />
|
<Setter Property="Command" Value="{Binding Data.SelectLeftPropertyCommand, Source={StaticResource DataContextProxy}}" />
|
||||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||||
<Setter Property="CommandTarget" Value="{Binding}" />
|
<Setter Property="CommandTarget" Value="{Binding}" />
|
||||||
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
|
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
|
||||||
<Setter Property="IsSubmenuOpen" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
|
<Setter Property="IsSubmenuOpen" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
|
||||||
|
<Setter Property="HeaderTemplate" Value="{StaticResource DataModelSelectionTemplate}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ContextMenu.ItemContainerStyle>
|
</ContextMenu.ItemContainerStyle>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@ -119,12 +160,12 @@
|
|||||||
<ContextMenu.ItemContainerStyle>
|
<ContextMenu.ItemContainerStyle>
|
||||||
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
|
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
|
||||||
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
||||||
<Setter Property="Header" Value="{Binding PropertyDescription.Name}" />
|
|
||||||
<Setter Property="ToolTip" Value="{Binding PropertyDescription.Description}" />
|
|
||||||
<Setter Property="Command" Value="{Binding Data.SelectRightPropertyCommand, Source={StaticResource DataContextProxy}}" />
|
<Setter Property="Command" Value="{Binding Data.SelectRightPropertyCommand, Source={StaticResource DataContextProxy}}" />
|
||||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||||
<Setter Property="CommandTarget" Value="{Binding}" />
|
<Setter Property="CommandTarget" Value="{Binding}" />
|
||||||
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
|
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
|
||||||
|
<Setter Property="IsSubmenuOpen" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
|
||||||
|
<Setter Property="HeaderTemplate" Value="{StaticResource DataModelSelectionTemplate}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ContextMenu.ItemContainerStyle>
|
</ContextMenu.ItemContainerStyle>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@ -139,8 +180,8 @@
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- Right side property if type is static -->
|
<!-- Right side property if type is static -->
|
||||||
<materialDesign:Transitioner SelectedIndex="{Binding RightSideTransitionIndex}"
|
<materialDesign:Transitioner SelectedIndex="{Binding RightSideTransitionIndex}"
|
||||||
DefaultTransitionOrigin="0.5, 0.5"
|
DefaultTransitionOrigin="0.5, 0.5"
|
||||||
Margin="3 -4"
|
Margin="3 -4"
|
||||||
Visibility="{Binding ShowRightSidePropertySelection, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}">
|
Visibility="{Binding ShowRightSidePropertySelection, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}">
|
||||||
<Button Style="{StaticResource DisplayConditionButton}"
|
<Button Style="{StaticResource DisplayConditionButton}"
|
||||||
@ -150,7 +191,7 @@
|
|||||||
Command="{s:Action ActivateRightSideInputViewModel}"
|
Command="{s:Action ActivateRightSideInputViewModel}"
|
||||||
HorizontalAlignment="Left">
|
HorizontalAlignment="Left">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Visibility="{Binding RightStaticValue, Converter={StaticResource NullToVisibilityConverter}}" Orientation="Horizontal" >
|
<StackPanel Visibility="{Binding RightStaticValue, Converter={StaticResource NullToVisibilityConverter}}" Orientation="Horizontal">
|
||||||
<TextBlock FontWeight="Light"
|
<TextBlock FontWeight="Light"
|
||||||
Text="{Binding SelectedLeftSideProperty.PropertyDescription.Prefix}"
|
Text="{Binding SelectedLeftSideProperty.PropertyDescription.Prefix}"
|
||||||
Visibility="{Binding SelectedLeftSideProperty.PropertyDescription.Prefix, Converter={StaticResource NullToVisibilityConverter}}" />
|
Visibility="{Binding SelectedLeftSideProperty.PropertyDescription.Prefix, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||||
@ -168,8 +209,9 @@
|
|||||||
<Border BorderBrush="{DynamicResource PrimaryHueMidBrush}"
|
<Border BorderBrush="{DynamicResource PrimaryHueMidBrush}"
|
||||||
Background="{DynamicResource MaterialDesignPaper}"
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
CornerRadius="3"
|
CornerRadius="3"
|
||||||
Padding="3"
|
Padding="3"
|
||||||
HorizontalAlignment="Left">
|
HorizontalAlignment="Left"
|
||||||
|
MinWidth="140">
|
||||||
<ContentControl s:View.Model="{Binding RightSideInputViewModel}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
|
<ContentControl s:View.Model="{Binding RightSideInputViewModel}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
|
||||||
</Border>
|
</Border>
|
||||||
</materialDesign:Transitioner>
|
</materialDesign:Transitioner>
|
||||||
|
|||||||
@ -5,6 +5,8 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Artemis.Core.Models.Profile.Conditions;
|
using Artemis.Core.Models.Profile.Conditions;
|
||||||
|
using Artemis.Core.Plugins.Models;
|
||||||
|
using Artemis.Core.Services;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using Artemis.UI.Events;
|
using Artemis.UI.Events;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions.Abstract;
|
using Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions.Abstract;
|
||||||
@ -37,7 +39,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions
|
|||||||
private List<Type> _supportedInputTypes;
|
private List<Type> _supportedInputTypes;
|
||||||
|
|
||||||
public DisplayConditionPredicateViewModel(DisplayConditionPredicate displayConditionPredicate, DisplayConditionViewModel parent, IProfileEditorService profileEditorService,
|
public DisplayConditionPredicateViewModel(DisplayConditionPredicate displayConditionPredicate, DisplayConditionViewModel parent, IProfileEditorService profileEditorService,
|
||||||
IDataModelVisualizationService dataModelVisualizationService, IDataModelService dataModelService, IEventAggregator eventAggregator)
|
IDataModelVisualizationService dataModelVisualizationService, IDataModelService dataModelService, ISettingsService settingsService, IEventAggregator eventAggregator)
|
||||||
: base(displayConditionPredicate, parent)
|
: base(displayConditionPredicate, parent)
|
||||||
{
|
{
|
||||||
_profileEditorService = profileEditorService;
|
_profileEditorService = profileEditorService;
|
||||||
@ -49,6 +51,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions
|
|||||||
SelectRightPropertyCommand = new DelegateCommand(ExecuteSelectRightProperty);
|
SelectRightPropertyCommand = new DelegateCommand(ExecuteSelectRightProperty);
|
||||||
SelectOperatorCommand = new DelegateCommand(ExecuteSelectOperatorCommand);
|
SelectOperatorCommand = new DelegateCommand(ExecuteSelectOperatorCommand);
|
||||||
|
|
||||||
|
ShowDataModelValues = settingsService.GetSetting<bool>("ProfileEditor.ShowDataModelValues");
|
||||||
|
|
||||||
// Initialize async, no need to wait for it
|
// Initialize async, no need to wait for it
|
||||||
Task.Run(Initialize);
|
Task.Run(Initialize);
|
||||||
}
|
}
|
||||||
@ -56,6 +60,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions
|
|||||||
public DisplayConditionPredicate DisplayConditionPredicate => (DisplayConditionPredicate) Model;
|
public DisplayConditionPredicate DisplayConditionPredicate => (DisplayConditionPredicate) Model;
|
||||||
public bool ShowRightSidePropertySelection => DisplayConditionPredicate.PredicateType == PredicateType.Dynamic;
|
public bool ShowRightSidePropertySelection => DisplayConditionPredicate.PredicateType == PredicateType.Dynamic;
|
||||||
public bool CanActivateRightSideInputViewModel => SelectedLeftSideProperty?.PropertyInfo != null;
|
public bool CanActivateRightSideInputViewModel => SelectedLeftSideProperty?.PropertyInfo != null;
|
||||||
|
public PluginSetting<bool> ShowDataModelValues { get; }
|
||||||
|
|
||||||
public bool IsInitialized
|
public bool IsInitialized
|
||||||
{
|
{
|
||||||
@ -262,8 +267,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.DisplayConditions
|
|||||||
|
|
||||||
private void RightDataModelUpdateRequested(object sender, EventArgs e)
|
private void RightDataModelUpdateRequested(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var leftSideType = SelectedLeftSideProperty?.PropertyInfo?.PropertyType;
|
||||||
if (DisplayConditionPredicate.PredicateType == PredicateType.Dynamic)
|
if (DisplayConditionPredicate.PredicateType == PredicateType.Dynamic)
|
||||||
SelectedRightSideProperty = LeftSideDataModel.GetChildForCondition(DisplayConditionPredicate, DisplayConditionSide.Right);
|
SelectedRightSideProperty = LeftSideDataModel.GetChildForCondition(DisplayConditionPredicate, DisplayConditionSide.Right);
|
||||||
|
|
||||||
|
// With the data model updated, also reapply the filter
|
||||||
|
RightSideDataModel.ApplyTypeFilter(true, leftSideType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LeftDataModelUpdateRequested(object sender, EventArgs e)
|
private void LeftDataModelUpdateRequested(object sender, EventArgs e)
|
||||||
|
|||||||
@ -195,7 +195,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
|||||||
protected override void OnInitialActivate()
|
protected override void OnInitialActivate()
|
||||||
{
|
{
|
||||||
LoadWorkspaceSettings();
|
LoadWorkspaceSettings();
|
||||||
_profileEditorService.StopRegularRender();
|
Module.IsProfileUpdatingDisabled = true;
|
||||||
Module.ActiveProfileChanged += ModuleOnActiveProfileChanged;
|
Module.ActiveProfileChanged += ModuleOnActiveProfileChanged;
|
||||||
Execute.PostToUIThread(LoadProfiles);
|
Execute.PostToUIThread(LoadProfiles);
|
||||||
base.OnInitialActivate();
|
base.OnInitialActivate();
|
||||||
@ -204,7 +204,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
|||||||
protected override void OnClose()
|
protected override void OnClose()
|
||||||
{
|
{
|
||||||
SaveWorkspaceSettings();
|
SaveWorkspaceSettings();
|
||||||
_profileEditorService.ResumeRegularRender();
|
Module.IsProfileUpdatingDisabled = false;
|
||||||
Module.ActiveProfileChanged -= ModuleOnActiveProfileChanged;
|
Module.ActiveProfileChanged -= ModuleOnActiveProfileChanged;
|
||||||
base.OnClose();
|
base.OnClose();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,6 +175,32 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:Card>
|
</materialDesign:Card>
|
||||||
|
|
||||||
|
<!-- Profile editor settings -->
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Profile editor</TextBlock>
|
||||||
|
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||||
|
<StackPanel Margin="15">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Show condition data model values</TextBlock>
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
|
||||||
|
While selecting a condition target, show the current values of the data model
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||||
|
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding ShowDataModelValues}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</materialDesign:Card>
|
||||||
|
|
||||||
<!-- Rendering settings -->
|
<!-- Rendering settings -->
|
||||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Rendering</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" Margin="0 15">Rendering</TextBlock>
|
||||||
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0,0,5,0">
|
||||||
|
|||||||
@ -119,6 +119,16 @@ namespace Artemis.UI.Screens.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ShowDataModelValues
|
||||||
|
{
|
||||||
|
get => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false).Value;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false).Value = value;
|
||||||
|
_settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false).Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Tuple<string, double> SelectedRenderScale
|
public Tuple<string, double> SelectedRenderScale
|
||||||
{
|
{
|
||||||
get => RenderScales.FirstOrDefault(s => Math.Abs(s.Item2 - RenderScale) < 0.01);
|
get => RenderScales.FirstOrDefault(s => Math.Abs(s.Item2 - RenderScale) < 0.01);
|
||||||
|
|||||||
@ -1,9 +1,22 @@
|
|||||||
using Artemis.Plugins.Modules.General.DataModel.Windows;
|
using System;
|
||||||
|
using Artemis.Plugins.Modules.General.DataModel.Windows;
|
||||||
|
|
||||||
namespace Artemis.Plugins.Modules.General.DataModel
|
namespace Artemis.Plugins.Modules.General.DataModel
|
||||||
{
|
{
|
||||||
public class GeneralDataModel : Core.Plugins.Abstract.DataModels.DataModel
|
public class GeneralDataModel : Core.Plugins.Abstract.DataModels.DataModel
|
||||||
{
|
{
|
||||||
|
public GeneralDataModel()
|
||||||
|
{
|
||||||
|
TimeDataModel = new TimeDataModel();
|
||||||
|
}
|
||||||
|
|
||||||
public WindowDataModel ActiveWindow { get; set; }
|
public WindowDataModel ActiveWindow { get; set; }
|
||||||
|
public TimeDataModel TimeDataModel { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TimeDataModel : Core.Plugins.Abstract.DataModels.DataModel
|
||||||
|
{
|
||||||
|
public DateTime CurrentTime { get; set; }
|
||||||
|
public DateTime CurrentTimeUTC { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Artemis.Core.Plugins.Abstract;
|
using Artemis.Core.Plugins.Abstract;
|
||||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
@ -18,6 +19,9 @@ namespace Artemis.Plugins.Modules.General
|
|||||||
|
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
|
DataModel.TimeDataModel.CurrentTime = DateTime.Now;
|
||||||
|
DataModel.TimeDataModel.CurrentTimeUTC = DateTime.UtcNow;
|
||||||
|
|
||||||
UpdateCurrentWindow();
|
UpdateCurrentWindow();
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
}
|
}
|
||||||
@ -38,7 +42,7 @@ namespace Artemis.Plugins.Modules.General
|
|||||||
public void UpdateCurrentWindow()
|
public void UpdateCurrentWindow()
|
||||||
{
|
{
|
||||||
var processId = WindowUtilities.GetActiveProcessId();
|
var processId = WindowUtilities.GetActiveProcessId();
|
||||||
if (DataModel.ActiveWindow == null || DataModel.ActiveWindow.Process.Id != processId)
|
if (DataModel.ActiveWindow == null || DataModel.ActiveWindow.Process.Id != processId)
|
||||||
DataModel.ActiveWindow = new WindowDataModel(Process.GetProcessById(processId));
|
DataModel.ActiveWindow = new WindowDataModel(Process.GetProcessById(processId));
|
||||||
if (DataModel.ActiveWindow != null && string.IsNullOrWhiteSpace(DataModel.ActiveWindow.WindowTitle))
|
if (DataModel.ActiveWindow != null && string.IsNullOrWhiteSpace(DataModel.ActiveWindow.WindowTitle))
|
||||||
DataModel.ActiveWindow.WindowTitle = Process.GetProcessById(WindowUtilities.GetActiveProcessId()).MainWindowTitle;
|
DataModel.ActiveWindow.WindowTitle = Process.GetProcessById(WindowUtilities.GetActiveProcessId()).MainWindowTitle;
|
||||||
|
|||||||
@ -1,12 +1,24 @@
|
|||||||
using Artemis.Core.Plugins.Abstract;
|
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
|
||||||
|
|
||||||
namespace Artemis.Plugins.Modules.General.ViewModels
|
namespace Artemis.Plugins.Modules.General.ViewModels
|
||||||
{
|
{
|
||||||
public class GeneralViewModel : ModuleViewModel
|
public class GeneralViewModel : ModuleViewModel
|
||||||
{
|
{
|
||||||
public GeneralViewModel(Module module) : base(module, "General")
|
public GeneralModule GeneralModule { get; }
|
||||||
|
|
||||||
|
public GeneralViewModel(GeneralModule module) : base(module, "General")
|
||||||
{
|
{
|
||||||
|
GeneralModule = module;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowUTCTimeInDataModel()
|
||||||
|
{
|
||||||
|
GeneralModule.ShowProperty(model => model.TimeDataModel.CurrentTimeUTC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideUTCTimeInDataModel()
|
||||||
|
{
|
||||||
|
GeneralModule.HideProperty(model => model.TimeDataModel.CurrentTimeUTC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,9 +4,20 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Artemis.Plugins.Modules.General.Views"
|
xmlns:local="clr-namespace:Artemis.Plugins.Modules.General.Views"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||||
<Label>Test</Label>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button Grid.Column="0" Style="{StaticResource MaterialDesignRaisedLightButton}" Command="{s:Action ShowUTCTimeInDataModel}" Margin="0 0 25 0">
|
||||||
|
ShowUTCTimeInDataModel
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Grid.Column="1" Style="{StaticResource MaterialDesignRaisedButton}" Command="{s:Action HideUTCTimeInDataModel}" Margin="25 0 0 0">
|
||||||
|
HideUTCTimeInDataModel
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
Loading…
x
Reference in New Issue
Block a user