mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Modules - Added ListItemName prop to the DataModelProperty attribute
Conditions - Display the full path of a condition (can be disabled in the editor options menu) Hotkeys - Fixed hotkeys not working after restarting Artemis Profile editor - Fixed display conditions not showing last selected layer on editor open
This commit is contained in:
parent
4034f438ed
commit
4fe0ea38cb
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Artemis.Core.Modules;
|
||||||
using Artemis.Storage.Entities.Profile;
|
using Artemis.Storage.Entities.Profile;
|
||||||
using Artemis.Storage.Entities.Profile.Conditions;
|
using Artemis.Storage.Entities.Profile.Conditions;
|
||||||
|
|
||||||
@ -69,7 +70,10 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
if (Entity.LeftPath != null)
|
if (Entity.LeftPath != null)
|
||||||
LeftPath = DataModelConditionList.ListType != null
|
LeftPath = DataModelConditionList.ListType != null
|
||||||
? new DataModelPath(ListPredicateWrapperDataModel.Create(DataModelConditionList.ListType), Entity.LeftPath)
|
? new DataModelPath(ListPredicateWrapperDataModel.Create(
|
||||||
|
DataModelConditionList.ListType,
|
||||||
|
DataModelConditionList.ListPath?.GetPropertyDescription()?.ListItemName
|
||||||
|
), Entity.LeftPath)
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +86,10 @@ namespace Artemis.Core
|
|||||||
if (Entity.RightPath.WrapperType == PathWrapperType.List)
|
if (Entity.RightPath.WrapperType == PathWrapperType.List)
|
||||||
{
|
{
|
||||||
RightPath = DataModelConditionList.ListType != null
|
RightPath = DataModelConditionList.ListType != null
|
||||||
? new DataModelPath(ListPredicateWrapperDataModel.Create(DataModelConditionList.ListType), Entity.RightPath)
|
? new DataModelPath(ListPredicateWrapperDataModel.Create(
|
||||||
|
DataModelConditionList.ListType,
|
||||||
|
DataModelConditionList.ListPath?.GetPropertyDescription()?.ListItemName
|
||||||
|
), Entity.RightPath)
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
// Right side dynamic
|
// Right side dynamic
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using Artemis.Core.Modules;
|
using Artemis.Core.Modules;
|
||||||
|
|
||||||
namespace Artemis.Core
|
namespace Artemis.Core
|
||||||
{
|
{
|
||||||
internal class ListPredicateWrapperDataModel<T> : ListPredicateWrapperDataModel
|
internal class ListPredicateWrapperDataModel<T> : ListPredicateWrapperDataModel
|
||||||
{
|
{
|
||||||
[DataModelProperty(Name = "List item", Description = "The current item in the list")]
|
|
||||||
public T Value => (UntypedValue is T typedValue ? typedValue : default)!;
|
public T Value => (UntypedValue is T typedValue ? typedValue : default)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,15 +26,34 @@ namespace Artemis.Core
|
|||||||
public object? UntypedValue { get; set; }
|
public object? UntypedValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of the <see cref="ListPredicateWrapperDataModel"/> class
|
/// Gets or sets the name of the list item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ListPredicateWrapperDataModel Create(Type type)
|
[DataModelIgnore]
|
||||||
|
public string? ItemName { get; set; }
|
||||||
|
|
||||||
|
#region Overrides of DataModel
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override DataModelPropertyAttribute? GetPropertyDescription(PropertyInfo propertyInfo)
|
||||||
{
|
{
|
||||||
object? instance = Activator.CreateInstance(typeof(ListPredicateWrapperDataModel<>).MakeGenericType(type));
|
if (!string.IsNullOrWhiteSpace(ItemName))
|
||||||
|
return new DataModelPropertyAttribute {Name = ItemName};
|
||||||
|
return base.GetPropertyDescription(propertyInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="ListPredicateWrapperDataModel" /> class
|
||||||
|
/// </summary>
|
||||||
|
public static ListPredicateWrapperDataModel Create(Type type, string? name = null)
|
||||||
|
{
|
||||||
|
ListPredicateWrapperDataModel? instance = Activator.CreateInstance(typeof(ListPredicateWrapperDataModel<>).MakeGenericType(type)) as ListPredicateWrapperDataModel;
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
throw new ArtemisCoreException($"Failed to create an instance of ListPredicateWrapperDataModel<T> for type {type.Name}");
|
throw new ArtemisCoreException($"Failed to create an instance of ListPredicateWrapperDataModel<T> for type {type.Name}");
|
||||||
|
|
||||||
return (ListPredicateWrapperDataModel) instance;
|
instance.ItemName = name;
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ namespace Artemis.Core
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Static types may have one as an attribute
|
// Static types may have one as an attribute
|
||||||
DataModelPropertyAttribute? attribute = (DataModelPropertyAttribute?) Attribute.GetCustomAttribute(propertyInfo, typeof(DataModelPropertyAttribute));
|
DataModelPropertyAttribute? attribute = DataModelPath.Target?.GetPropertyDescription(propertyInfo);
|
||||||
if (attribute != null)
|
if (attribute != null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(attribute.Name))
|
if (string.IsNullOrWhiteSpace(attribute.Name))
|
||||||
|
|||||||
@ -28,6 +28,11 @@ namespace Artemis.Core.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Affix { get; set; }
|
public string? Affix { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of list items, only applicable to enumerable data model properties
|
||||||
|
/// </summary>
|
||||||
|
public string? ListItemName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets an optional maximum value, this value is not enforced but used for percentage calculations.
|
/// Gets or sets an optional maximum value, this value is not enforced but used for percentage calculations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -69,6 +69,15 @@ namespace Artemis.Core.Modules
|
|||||||
return Module.HiddenProperties;
|
return Module.HiddenProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the property description of the provided property info
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>If found, the property description attribute, otherwise <see langword="null"/>.</returns>
|
||||||
|
public virtual DataModelPropertyAttribute? GetPropertyDescription(PropertyInfo propertyInfo)
|
||||||
|
{
|
||||||
|
return (DataModelPropertyAttribute?) Attribute.GetCustomAttribute(propertyInfo, typeof(DataModelPropertyAttribute));
|
||||||
|
}
|
||||||
|
|
||||||
#region Dynamic children
|
#region Dynamic children
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -49,6 +49,7 @@ namespace Artemis.Core.Services
|
|||||||
_pluginManagementService.PluginFeatureEnabled += PluginManagementServiceOnPluginFeatureToggled;
|
_pluginManagementService.PluginFeatureEnabled += PluginManagementServiceOnPluginFeatureToggled;
|
||||||
_pluginManagementService.PluginFeatureDisabled += PluginManagementServiceOnPluginFeatureToggled;
|
_pluginManagementService.PluginFeatureDisabled += PluginManagementServiceOnPluginFeatureToggled;
|
||||||
|
|
||||||
|
HotkeysEnabled = true;
|
||||||
inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp;
|
inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp;
|
||||||
|
|
||||||
if (!_profileCategories.Any())
|
if (!_profileCategories.Any())
|
||||||
|
|||||||
@ -30,12 +30,14 @@ namespace Artemis.UI.Shared.Input
|
|||||||
private bool _isDataModelViewModelOpen;
|
private bool _isDataModelViewModelOpen;
|
||||||
private bool _isEnabled = true;
|
private bool _isEnabled = true;
|
||||||
private string _placeholder = "Select a property";
|
private string _placeholder = "Select a property";
|
||||||
|
private readonly PluginSetting<bool> _showFullPath;
|
||||||
|
|
||||||
internal DataModelDynamicViewModel(List<Module> modules, ISettingsService settingsService, IDataModelUIService dataModelUIService)
|
internal DataModelDynamicViewModel(List<Module> modules, ISettingsService settingsService, IDataModelUIService dataModelUIService)
|
||||||
{
|
{
|
||||||
_modules = modules;
|
_modules = modules;
|
||||||
_dataModelUIService = dataModelUIService;
|
_dataModelUIService = dataModelUIService;
|
||||||
_updateTimer = new Timer(500);
|
_updateTimer = new Timer(500);
|
||||||
|
_showFullPath = settingsService.GetSetting("ProfileEditor.ShowFullPaths", true);
|
||||||
|
|
||||||
ExtraDataModelViewModels = new BindableCollection<DataModelPropertiesViewModel>();
|
ExtraDataModelViewModels = new BindableCollection<DataModelPropertiesViewModel>();
|
||||||
ShowDataModelValues = settingsService.GetSetting<bool>("ProfileEditor.ShowDataModelValues");
|
ShowDataModelValues = settingsService.GetSetting<bool>("ProfileEditor.ShowDataModelValues");
|
||||||
@ -127,6 +129,8 @@ namespace Artemis.UI.Shared.Input
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PluginSetting<bool> ShowDataModelValues { get; }
|
public PluginSetting<bool> ShowDataModelValues { get; }
|
||||||
|
|
||||||
|
public PluginSetting<bool> ShowFullPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets root the data model view model
|
/// Gets or sets root the data model view model
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -177,7 +181,15 @@ namespace Artemis.UI.Shared.Input
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the display name of the currently selected property
|
/// Gets the display name of the currently selected property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? DisplayValue => DataModelPath?.GetPropertyDescription()?.Name ?? DataModelPath?.Segments.LastOrDefault()?.Identifier;
|
public string? DisplayValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_showFullPath.Value)
|
||||||
|
return DisplayPath;
|
||||||
|
return DataModelPath?.GetPropertyDescription()?.Name ?? DataModelPath?.Segments.LastOrDefault()?.Identifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the human readable path of the currently selected property
|
/// Gets the human readable path of the currently selected property
|
||||||
@ -190,7 +202,8 @@ namespace Artemis.UI.Shared.Input
|
|||||||
return "Click to select a property";
|
return "Click to select a property";
|
||||||
if (!DataModelPath.IsValid)
|
if (!DataModelPath.IsValid)
|
||||||
return "Invalid path";
|
return "Invalid path";
|
||||||
return string.Join(" › ", DataModelPath.Segments.Select(s => s.GetPropertyDescription()?.Name ?? s.Identifier));
|
|
||||||
|
return string.Join(" › ", DataModelPath.Segments.Where(s => s.GetPropertyDescription()!= null).Select(s => s.GetPropertyDescription()!.Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,8 +257,10 @@ namespace Artemis.UI.Shared.Input
|
|||||||
ExtraDataModelViewModels.CollectionChanged += ExtraDataModelViewModelsOnCollectionChanged;
|
ExtraDataModelViewModels.CollectionChanged += ExtraDataModelViewModelsOnCollectionChanged;
|
||||||
_updateTimer.Start();
|
_updateTimer.Start();
|
||||||
_updateTimer.Elapsed += OnUpdateTimerOnElapsed;
|
_updateTimer.Elapsed += OnUpdateTimerOnElapsed;
|
||||||
|
_showFullPath.SettingChanged += ShowFullPathOnSettingChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ExecuteSelectPropertyCommand(object? context)
|
private void ExecuteSelectPropertyCommand(object? context)
|
||||||
{
|
{
|
||||||
if (context is not DataModelVisualizationViewModel selected)
|
if (context is not DataModelVisualizationViewModel selected)
|
||||||
@ -271,6 +286,7 @@ namespace Artemis.UI.Shared.Input
|
|||||||
_updateTimer.Stop();
|
_updateTimer.Stop();
|
||||||
_updateTimer.Dispose();
|
_updateTimer.Dispose();
|
||||||
_updateTimer.Elapsed -= OnUpdateTimerOnElapsed;
|
_updateTimer.Elapsed -= OnUpdateTimerOnElapsed;
|
||||||
|
_showFullPath.SettingChanged -= ShowFullPathOnSettingChanged;
|
||||||
|
|
||||||
DataModelViewModel?.Dispose();
|
DataModelViewModel?.Dispose();
|
||||||
DataModelPath?.Dispose();
|
DataModelPath?.Dispose();
|
||||||
@ -330,6 +346,11 @@ namespace Artemis.UI.Shared.Input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShowFullPathOnSettingChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
NotifyOfPropertyChange(nameof(DisplayValue));
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|||||||
@ -16,9 +16,9 @@ namespace Artemis.UI.Shared
|
|||||||
private int _index;
|
private int _index;
|
||||||
private Type? _listType;
|
private Type? _listType;
|
||||||
|
|
||||||
internal DataModelListPropertiesViewModel(Type listType) : base(null, null, null)
|
internal DataModelListPropertiesViewModel(Type listType, string? name) : base(null, null, null)
|
||||||
{
|
{
|
||||||
_listPredicateWrapper = ListPredicateWrapperDataModel.Create(listType);
|
_listPredicateWrapper = ListPredicateWrapperDataModel.Create(listType, name);
|
||||||
DataModel = _listPredicateWrapper;
|
DataModel = _listPredicateWrapper;
|
||||||
ListType = listType;
|
ListType = listType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,17 +14,17 @@ namespace Artemis.UI.Shared
|
|||||||
private int _index;
|
private int _index;
|
||||||
private Type? _listType;
|
private Type? _listType;
|
||||||
|
|
||||||
internal DataModelListPropertyViewModel(Type listType, DataModelDisplayViewModel displayViewModel) : base(null, null, null)
|
internal DataModelListPropertyViewModel(Type listType, DataModelDisplayViewModel displayViewModel, string? name) : base(null, null, null)
|
||||||
{
|
{
|
||||||
_listPredicateWrapper = ListPredicateWrapperDataModel.Create(listType);
|
_listPredicateWrapper = ListPredicateWrapperDataModel.Create(listType, name);
|
||||||
DataModel = _listPredicateWrapper;
|
DataModel = _listPredicateWrapper;
|
||||||
ListType = listType;
|
ListType = listType;
|
||||||
DisplayViewModel = displayViewModel;
|
DisplayViewModel = displayViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DataModelListPropertyViewModel(Type listType) : base(null, null, null)
|
internal DataModelListPropertyViewModel(Type listType, string? name) : base(null, null, null)
|
||||||
{
|
{
|
||||||
_listPredicateWrapper = ListPredicateWrapperDataModel.Create(listType);
|
_listPredicateWrapper = ListPredicateWrapperDataModel.Create(listType, name);
|
||||||
DataModel = _listPredicateWrapper;
|
DataModel = _listPredicateWrapper;
|
||||||
ListType = listType;
|
ListType = listType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ namespace Artemis.UI.Shared
|
|||||||
DataModelVisualizationViewModel? child;
|
DataModelVisualizationViewModel? child;
|
||||||
if (ListChildren.Count <= index)
|
if (ListChildren.Count <= index)
|
||||||
{
|
{
|
||||||
child = CreateListChild(dataModelUIService, item.GetType());
|
child = CreateListChild(dataModelUIService, item.GetType(), DataModelPath?.GetPropertyDescription()?.ListItemName);
|
||||||
if (child == null)
|
if (child == null)
|
||||||
continue;
|
continue;
|
||||||
ListChildren.Add(child);
|
ListChildren.Add(child);
|
||||||
@ -130,18 +130,18 @@ namespace Artemis.UI.Shared
|
|||||||
return $"[List] {DisplayPath ?? Path} - {ListCount} item(s)";
|
return $"[List] {DisplayPath ?? Path} - {ListCount} item(s)";
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataModelVisualizationViewModel? CreateListChild(IDataModelUIService dataModelUIService, Type listType)
|
private DataModelVisualizationViewModel? CreateListChild(IDataModelUIService dataModelUIService, Type listType, string? name)
|
||||||
{
|
{
|
||||||
// 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
|
||||||
DataModelDisplayViewModel? typeViewModel = dataModelUIService.GetDataModelDisplayViewModel(listType, PropertyDescription);
|
DataModelDisplayViewModel? typeViewModel = dataModelUIService.GetDataModelDisplayViewModel(listType, PropertyDescription);
|
||||||
if (typeViewModel != null)
|
if (typeViewModel != null)
|
||||||
return new DataModelListPropertyViewModel(listType, typeViewModel);
|
return new DataModelListPropertyViewModel(listType, typeViewModel, name);
|
||||||
// For primitives, create a property view model, it may be null that is fine
|
// For primitives, create a property view model, it may be null that is fine
|
||||||
if (listType.IsPrimitive || listType.IsEnum || listType == typeof(string))
|
if (listType.IsPrimitive || listType.IsEnum || listType == typeof(string))
|
||||||
return new DataModelListPropertyViewModel(listType);
|
return new DataModelListPropertyViewModel(listType, name);
|
||||||
// For other value types create a child view model
|
// For other value types create a child view model
|
||||||
if (listType.IsClass || listType.IsStruct())
|
if (listType.IsClass || listType.IsStruct())
|
||||||
return new DataModelListPropertiesViewModel(listType);
|
return new DataModelListPropertiesViewModel(listType, name);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,8 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
: base(dataModelConditionListPredicate, modules, profileEditorService, dataModelUIService, conditionOperatorService, settingsService)
|
: base(dataModelConditionListPredicate, modules, profileEditorService, dataModelUIService, conditionOperatorService, settingsService)
|
||||||
{
|
{
|
||||||
_dataModelUIService = dataModelUIService;
|
_dataModelUIService = dataModelUIService;
|
||||||
|
DataModelPathSegment dataModelPathSegment = dataModelConditionListPredicate.LeftPath.Segments.ToList()[1];
|
||||||
|
var segmentDescription = dataModelPathSegment.GetPropertyDescription();
|
||||||
LeftSideColor = new SolidColorBrush(Color.FromRgb(71, 108, 188));
|
LeftSideColor = new SolidColorBrush(Color.FromRgb(71, 108, 188));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
|
|
||||||
public override void Evaluate()
|
public override void Evaluate()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateModules()
|
public override void UpdateModules()
|
||||||
@ -88,7 +89,8 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
private DataModelPropertiesViewModel GetListDataModel()
|
private DataModelPropertiesViewModel GetListDataModel()
|
||||||
{
|
{
|
||||||
ListPredicateWrapperDataModel wrapper = ListPredicateWrapperDataModel.Create(
|
ListPredicateWrapperDataModel wrapper = ListPredicateWrapperDataModel.Create(
|
||||||
DataModelConditionListPredicate.DataModelConditionList.ListType
|
DataModelConditionListPredicate.DataModelConditionList.ListType!,
|
||||||
|
DataModelConditionListPredicate.DataModelConditionList.ListPath?.GetPropertyDescription()?.ListItemName
|
||||||
);
|
);
|
||||||
|
|
||||||
return wrapper.CreateViewModel(_dataModelUIService, new DataModelUpdateConfiguration(true));
|
return wrapper.CreateViewModel(_dataModelUIService, new DataModelUpdateConfiguration(true));
|
||||||
|
|||||||
@ -4,7 +4,6 @@ using System.ComponentModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.Core.Modules;
|
using Artemis.Core.Modules;
|
||||||
using Artemis.Core.Services;
|
|
||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
using Artemis.UI.Screens.ProfileEditor.Conditions;
|
using Artemis.UI.Screens.ProfileEditor.Conditions;
|
||||||
using Artemis.UI.Shared;
|
using Artemis.UI.Shared;
|
||||||
@ -91,6 +90,8 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
|||||||
protected override void OnInitialActivate()
|
protected override void OnInitialActivate()
|
||||||
{
|
{
|
||||||
_profileEditorService.SelectedProfileElementChanged += SelectedProfileEditorServiceOnSelectedProfileElementChanged;
|
_profileEditorService.SelectedProfileElementChanged += SelectedProfileEditorServiceOnSelectedProfileElementChanged;
|
||||||
|
Update(_profileEditorService.SelectedProfileElement);
|
||||||
|
|
||||||
base.OnInitialActivate();
|
base.OnInitialActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +102,11 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SelectedProfileEditorServiceOnSelectedProfileElementChanged(object sender, RenderProfileElementEventArgs e)
|
private void SelectedProfileEditorServiceOnSelectedProfileElementChanged(object sender, RenderProfileElementEventArgs e)
|
||||||
|
{
|
||||||
|
Update(e.RenderProfileElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update(RenderProfileElement renderProfileElement)
|
||||||
{
|
{
|
||||||
if (RenderProfileElement != null)
|
if (RenderProfileElement != null)
|
||||||
{
|
{
|
||||||
@ -109,26 +115,26 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
|||||||
RenderProfileElement.Timeline.PropertyChanged -= TimelineOnPropertyChanged;
|
RenderProfileElement.Timeline.PropertyChanged -= TimelineOnPropertyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderProfileElement = e.RenderProfileElement;
|
RenderProfileElement = renderProfileElement;
|
||||||
|
|
||||||
NotifyOfPropertyChange(nameof(DisplayContinuously));
|
NotifyOfPropertyChange(nameof(DisplayContinuously));
|
||||||
NotifyOfPropertyChange(nameof(AlwaysFinishTimeline));
|
NotifyOfPropertyChange(nameof(AlwaysFinishTimeline));
|
||||||
NotifyOfPropertyChange(nameof(ConditionBehaviourEnabled));
|
NotifyOfPropertyChange(nameof(ConditionBehaviourEnabled));
|
||||||
|
|
||||||
if (e.RenderProfileElement == null)
|
if (renderProfileElement == null)
|
||||||
{
|
{
|
||||||
ActiveItem = null;
|
ActiveItem = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the layer has a root display condition group
|
// Ensure the layer has a root display condition group
|
||||||
if (e.RenderProfileElement.DisplayCondition == null)
|
if (renderProfileElement.DisplayCondition == null)
|
||||||
e.RenderProfileElement.DisplayCondition = new DataModelConditionGroup(null);
|
renderProfileElement.DisplayCondition = new DataModelConditionGroup(null);
|
||||||
|
|
||||||
List<Module> modules = new();
|
List<Module> modules = new();
|
||||||
if (_profileEditorService.SelectedProfileConfiguration?.Module != null)
|
if (_profileEditorService.SelectedProfileConfiguration?.Module != null)
|
||||||
modules.Add(_profileEditorService.SelectedProfileConfiguration.Module);
|
modules.Add(_profileEditorService.SelectedProfileConfiguration.Module);
|
||||||
ActiveItem = _dataModelConditionsVmFactory.DataModelConditionGroupViewModel(e.RenderProfileElement.DisplayCondition, ConditionGroupType.General, modules);
|
ActiveItem = _dataModelConditionsVmFactory.DataModelConditionGroupViewModel(renderProfileElement.DisplayCondition, ConditionGroupType.General, modules);
|
||||||
ActiveItem.IsRootGroup = true;
|
ActiveItem.IsRootGroup = true;
|
||||||
|
|
||||||
DisplayStartHint = !RenderProfileElement.DisplayCondition.Children.Any();
|
DisplayStartHint = !RenderProfileElement.DisplayCondition.Children.Any();
|
||||||
|
|||||||
@ -122,7 +122,9 @@
|
|||||||
<MenuItem Header="Display Data Model Values"
|
<MenuItem Header="Display Data Model Values"
|
||||||
IsCheckable="True"
|
IsCheckable="True"
|
||||||
IsChecked="{Binding ShowDataModelValues.Value}"/>
|
IsChecked="{Binding ShowDataModelValues.Value}"/>
|
||||||
|
<MenuItem Header="Display Full Condition Paths"
|
||||||
|
IsCheckable="True"
|
||||||
|
IsChecked="{Binding ShowFullPaths.Value}"/>
|
||||||
<MenuItem Header="Apply All Data Bindings During Edit"
|
<MenuItem Header="Apply All Data Bindings During Edit"
|
||||||
ToolTip="If enabled, updates all data bindings instead of only the one you are editing"
|
ToolTip="If enabled, updates all data bindings instead of only the one you are editing"
|
||||||
IsCheckable="True"
|
IsCheckable="True"
|
||||||
|
|||||||
@ -118,6 +118,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
|||||||
public PluginSetting<GridLength> ElementPropertiesWidth => _settingsService.GetSetting("ProfileEditor.ElementPropertiesWidth", new GridLength(545));
|
public PluginSetting<GridLength> ElementPropertiesWidth => _settingsService.GetSetting("ProfileEditor.ElementPropertiesWidth", new GridLength(545));
|
||||||
public PluginSetting<bool> StopOnFocusLoss => _settingsService.GetSetting("ProfileEditor.StopOnFocusLoss", true);
|
public PluginSetting<bool> StopOnFocusLoss => _settingsService.GetSetting("ProfileEditor.StopOnFocusLoss", true);
|
||||||
public PluginSetting<bool> ShowDataModelValues => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false);
|
public PluginSetting<bool> ShowDataModelValues => _settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false);
|
||||||
|
public PluginSetting<bool> ShowFullPaths => _settingsService.GetSetting("ProfileEditor.ShowFullPaths", true);
|
||||||
public PluginSetting<bool> FocusSelectedLayer => _settingsService.GetSetting("ProfileEditor.FocusSelectedLayer", true);
|
public PluginSetting<bool> FocusSelectedLayer => _settingsService.GetSetting("ProfileEditor.FocusSelectedLayer", true);
|
||||||
public PluginSetting<bool> AlwaysApplyDataBindings => _settingsService.GetSetting("ProfileEditor.AlwaysApplyDataBindings", true);
|
public PluginSetting<bool> AlwaysApplyDataBindings => _settingsService.GetSetting("ProfileEditor.AlwaysApplyDataBindings", true);
|
||||||
|
|
||||||
@ -192,6 +193,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
|||||||
{
|
{
|
||||||
StopOnFocusLoss.AutoSave = true;
|
StopOnFocusLoss.AutoSave = true;
|
||||||
ShowDataModelValues.AutoSave = true;
|
ShowDataModelValues.AutoSave = true;
|
||||||
|
ShowFullPaths.AutoSave = true;
|
||||||
FocusSelectedLayer.AutoSave = true;
|
FocusSelectedLayer.AutoSave = true;
|
||||||
AlwaysApplyDataBindings.AutoSave = true;
|
AlwaysApplyDataBindings.AutoSave = true;
|
||||||
|
|
||||||
@ -205,6 +207,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
|||||||
{
|
{
|
||||||
StopOnFocusLoss.AutoSave = false;
|
StopOnFocusLoss.AutoSave = false;
|
||||||
ShowDataModelValues.AutoSave = false;
|
ShowDataModelValues.AutoSave = false;
|
||||||
|
ShowFullPaths.AutoSave = false;
|
||||||
FocusSelectedLayer.AutoSave = false;
|
FocusSelectedLayer.AutoSave = false;
|
||||||
AlwaysApplyDataBindings.AutoSave = false;
|
AlwaysApplyDataBindings.AutoSave = false;
|
||||||
|
|
||||||
|
|||||||
@ -256,7 +256,7 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Grid.Row="0">
|
<StackPanel Grid.Row="0" Margin="0 0 0 4">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignSubtitle1TextBlock}">
|
<TextBlock Style="{StaticResource MaterialDesignSubtitle1TextBlock}">
|
||||||
Activation conditions
|
Activation conditions
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user