mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 09:43:46 +00:00
Data model conditions - Simplified list VM code
Data model conditions - When selecting a different type, recheck if a new preferred operator is available
This commit is contained in:
parent
13df88ca40
commit
e1eb03667e
@ -93,18 +93,6 @@ namespace Artemis.Core
|
|||||||
|
|
||||||
#region Modification
|
#region Modification
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the left side of the predicate
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">The path pointing to the left side value inside the list</param>
|
|
||||||
public override void UpdateLeftSide(DataModelPath? path)
|
|
||||||
{
|
|
||||||
if (DataModelConditionList.IsPrimitiveList)
|
|
||||||
throw new ArtemisCoreException("Cannot apply a left side to a predicate inside a primitive list");
|
|
||||||
|
|
||||||
base.UpdateLeftSide(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Type? GetPreferredRightSideType()
|
public override Type? GetPreferredRightSideType()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,8 +15,6 @@ namespace Artemis.UI.Shared
|
|||||||
{
|
{
|
||||||
DataModel = ListPredicateWrapperDataModel.Create(listType);
|
DataModel = ListPredicateWrapperDataModel.Create(listType);
|
||||||
ListType = listType;
|
ListType = listType;
|
||||||
|
|
||||||
IsRootViewModel = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Index
|
public int Index
|
||||||
|
|||||||
@ -44,31 +44,7 @@ namespace Artemis.UI.Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BindableCollection<DataModelVisualizationViewModel> ListChildren { get; set; }
|
public BindableCollection<DataModelVisualizationViewModel> ListChildren { get; set; }
|
||||||
|
|
||||||
public DataModelPropertiesViewModel GetListTypeViewModel(IDataModelUIService dataModelUIService)
|
|
||||||
{
|
|
||||||
Type listType = DataModelPath.GetPropertyType()?.GetGenericEnumerableType();
|
|
||||||
if (listType == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Create a property VM describing the type of the list
|
|
||||||
DataModelVisualizationViewModel viewModel = CreateListChild(dataModelUIService, listType);
|
|
||||||
viewModel.Update(dataModelUIService);
|
|
||||||
|
|
||||||
// Put an empty value into the list type property view model
|
|
||||||
if (viewModel is DataModelListPropertiesViewModel dataModelListClassViewModel) return dataModelListClassViewModel;
|
|
||||||
|
|
||||||
if (viewModel is DataModelListPropertyViewModel dataModelListPropertyViewModel)
|
|
||||||
{
|
|
||||||
dataModelListPropertyViewModel.DisplayValue = Activator.CreateInstance(dataModelListPropertyViewModel.ListType);
|
|
||||||
DataModelPropertiesViewModel wrapper = new DataModelPropertiesViewModel(null, null, null);
|
|
||||||
wrapper.Children.Add(dataModelListPropertyViewModel);
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Update(IDataModelUIService dataModelUIService)
|
public override void Update(IDataModelUIService dataModelUIService)
|
||||||
{
|
{
|
||||||
if (Parent != null && !Parent.IsVisualizationExpanded)
|
if (Parent != null && !Parent.IsVisualizationExpanded)
|
||||||
|
|||||||
@ -142,41 +142,6 @@ namespace Artemis.UI.Shared
|
|||||||
IsMatchingFilteredTypes = filteredTypes.Any(t => t == type || t == typeof(Enum) && type.IsEnum);
|
IsMatchingFilteredTypes = filteredTypes.Any(t => t == type || t == typeof(Enum) && type.IsEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataModelVisualizationViewModel GetChildByPath(Guid dataModelGuid, string propertyPath)
|
|
||||||
{
|
|
||||||
if (!IsRootViewModel)
|
|
||||||
{
|
|
||||||
if (DataModel.PluginInfo.Guid != dataModelGuid)
|
|
||||||
return null;
|
|
||||||
if (propertyPath == null)
|
|
||||||
return null;
|
|
||||||
if (Path != null && Path.StartsWith(propertyPath, StringComparison.OrdinalIgnoreCase))
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure children are populated by requesting an update
|
|
||||||
if (!IsVisualizationExpanded)
|
|
||||||
{
|
|
||||||
IsVisualizationExpanded = true;
|
|
||||||
RequestUpdate();
|
|
||||||
IsVisualizationExpanded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (DataModelVisualizationViewModel child in Children)
|
|
||||||
{
|
|
||||||
// Try the child itself first
|
|
||||||
if (child.Path == propertyPath)
|
|
||||||
return child;
|
|
||||||
|
|
||||||
// Try a child on the child next, this will go recursive
|
|
||||||
DataModelVisualizationViewModel match = child.GetChildByPath(dataModelGuid, propertyPath);
|
|
||||||
if (match != null)
|
|
||||||
return match;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal virtual int GetChildDepth()
|
internal virtual int GetChildDepth()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -187,7 +152,7 @@ namespace Artemis.UI.Shared
|
|||||||
if (IsRootViewModel && DataModel == null)
|
if (IsRootViewModel && DataModel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Type modelType = IsRootViewModel ? DataModel.GetType() : DataModelPath?.GetPropertyType() ?? DataModel.GetType();
|
Type modelType = IsRootViewModel ? DataModel.GetType() : DataModelPath.GetPropertyType();
|
||||||
|
|
||||||
// Add missing static children
|
// Add missing static children
|
||||||
foreach (PropertyInfo propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance).OrderBy(t => t.MetadataToken))
|
foreach (PropertyInfo propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance).OrderBy(t => t.MetadataToken))
|
||||||
|
|||||||
@ -99,7 +99,11 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
Operators.Clear();
|
Operators.Clear();
|
||||||
Operators.AddRange(_conditionOperatorService.GetConditionOperatorsForType(leftSideType ?? typeof(object), ConditionParameterSide.Left));
|
Operators.AddRange(_conditionOperatorService.GetConditionOperatorsForType(leftSideType ?? typeof(object), ConditionParameterSide.Left));
|
||||||
if (DataModelConditionPredicate.Operator == null)
|
if (DataModelConditionPredicate.Operator == null)
|
||||||
DataModelConditionPredicate.UpdateOperator(Operators.FirstOrDefault(o => o.SupportsType(leftSideType ?? typeof(object), ConditionParameterSide.Left)));
|
DataModelConditionPredicate.UpdateOperator(Operators.FirstOrDefault());
|
||||||
|
// The core doesn't care about best matches so if there is a new preferred operator, use that instead
|
||||||
|
else if (!Operators.Contains(DataModelConditionPredicate.Operator))
|
||||||
|
DataModelConditionPredicate.UpdateOperator(Operators.FirstOrDefault(o => o.Description == DataModelConditionPredicate.Operator.Description) ?? Operators.FirstOrDefault());
|
||||||
|
|
||||||
SelectedOperator = DataModelConditionPredicate.Operator;
|
SelectedOperator = DataModelConditionPredicate.Operator;
|
||||||
|
|
||||||
// Without a selected operator or one that supports a right side, leave the right side input empty
|
// Without a selected operator or one that supports a right side, leave the right side input empty
|
||||||
|
|||||||
@ -24,13 +24,10 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
_profileEditorService = profileEditorService;
|
_profileEditorService = profileEditorService;
|
||||||
_dataModelUIService = dataModelUIService;
|
_dataModelUIService = dataModelUIService;
|
||||||
_dataModelConditionsVmFactory = dataModelConditionsVmFactory;
|
_dataModelConditionsVmFactory = dataModelConditionsVmFactory;
|
||||||
|
|
||||||
Initialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataModelConditionEvent DataModelConditionEvent => (DataModelConditionEvent) Model;
|
public DataModelConditionEvent DataModelConditionEvent => (DataModelConditionEvent) Model;
|
||||||
|
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
LeftSideSelectionViewModel = _dataModelUIService.GetDynamicSelectionViewModel(_profileEditorService.GetCurrentModule());
|
LeftSideSelectionViewModel = _dataModelUIService.GetDynamicSelectionViewModel(_profileEditorService.GetCurrentModule());
|
||||||
@ -40,8 +37,15 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
List<Type> supportedInputTypes = editors.Select(e => e.SupportedType).ToList();
|
List<Type> supportedInputTypes = editors.Select(e => e.SupportedType).ToList();
|
||||||
supportedInputTypes.AddRange(editors.Where(e => e.CompatibleConversionTypes != null).SelectMany(e => e.CompatibleConversionTypes));
|
supportedInputTypes.AddRange(editors.Where(e => e.CompatibleConversionTypes != null).SelectMany(e => e.CompatibleConversionTypes));
|
||||||
supportedInputTypes.Add(typeof(IEnumerable<>));
|
supportedInputTypes.Add(typeof(IEnumerable<>));
|
||||||
LeftSideSelectionViewModel.FilterTypes = supportedInputTypes.ToArray();
|
|
||||||
|
|
||||||
|
// Events are only supported in the root group enforce that here
|
||||||
|
if (Parent is DataModelConditionGroupViewModel groupViewModel && groupViewModel.IsRootGroup)
|
||||||
|
{
|
||||||
|
supportedInputTypes.Add(typeof(DataModelEvent));
|
||||||
|
supportedInputTypes.Add(typeof(DataModelEvent<>));
|
||||||
|
}
|
||||||
|
|
||||||
|
LeftSideSelectionViewModel.FilterTypes = supportedInputTypes.ToArray();
|
||||||
LeftSideSelectionViewModel.ButtonBrush = new SolidColorBrush(Color.FromRgb(185, 164, 10));
|
LeftSideSelectionViewModel.ButtonBrush = new SolidColorBrush(Color.FromRgb(185, 164, 10));
|
||||||
LeftSideSelectionViewModel.Placeholder = "Select an event";
|
LeftSideSelectionViewModel.Placeholder = "Select an event";
|
||||||
|
|
||||||
@ -91,6 +95,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialActivate()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
base.OnInitialActivate();
|
||||||
|
}
|
||||||
|
|
||||||
#region Event handlers
|
#region Event handlers
|
||||||
|
|
||||||
private void LeftSideSelectionViewModelOnPropertySelected(object? sender, DataModelInputDynamicEventArgs e)
|
private void LeftSideSelectionViewModelOnPropertySelected(object? sender, DataModelInputDynamicEventArgs e)
|
||||||
|
|||||||
@ -26,8 +26,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
_profileEditorService = profileEditorService;
|
_profileEditorService = profileEditorService;
|
||||||
_dataModelUIService = dataModelUIService;
|
_dataModelUIService = dataModelUIService;
|
||||||
_dataModelConditionsVmFactory = dataModelConditionsVmFactory;
|
_dataModelConditionsVmFactory = dataModelConditionsVmFactory;
|
||||||
|
|
||||||
Initialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataModelConditionList DataModelConditionList => (DataModelConditionList) Model;
|
public DataModelConditionList DataModelConditionList => (DataModelConditionList) Model;
|
||||||
@ -74,8 +72,15 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
List<Type> supportedInputTypes = editors.Select(e => e.SupportedType).ToList();
|
List<Type> supportedInputTypes = editors.Select(e => e.SupportedType).ToList();
|
||||||
supportedInputTypes.AddRange(editors.Where(e => e.CompatibleConversionTypes != null).SelectMany(e => e.CompatibleConversionTypes));
|
supportedInputTypes.AddRange(editors.Where(e => e.CompatibleConversionTypes != null).SelectMany(e => e.CompatibleConversionTypes));
|
||||||
supportedInputTypes.Add(typeof(IEnumerable<>));
|
supportedInputTypes.Add(typeof(IEnumerable<>));
|
||||||
LeftSideSelectionViewModel.FilterTypes = supportedInputTypes.ToArray();
|
|
||||||
|
|
||||||
|
// Events are only supported in the root group enforce that here
|
||||||
|
if (Parent is DataModelConditionGroupViewModel groupViewModel && groupViewModel.IsRootGroup)
|
||||||
|
{
|
||||||
|
supportedInputTypes.Add(typeof(DataModelEvent));
|
||||||
|
supportedInputTypes.Add(typeof(DataModelEvent<>));
|
||||||
|
}
|
||||||
|
|
||||||
|
LeftSideSelectionViewModel.FilterTypes = supportedInputTypes.ToArray();
|
||||||
LeftSideSelectionViewModel.ButtonBrush = new SolidColorBrush(Color.FromRgb(71, 108, 188));
|
LeftSideSelectionViewModel.ButtonBrush = new SolidColorBrush(Color.FromRgb(71, 108, 188));
|
||||||
LeftSideSelectionViewModel.Placeholder = "Select a list";
|
LeftSideSelectionViewModel.Placeholder = "Select a list";
|
||||||
|
|
||||||
@ -88,14 +93,13 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
bool converted = ConvertIfRequired(newType);
|
bool converted = ConvertIfRequired(newType);
|
||||||
if (converted)
|
if (converted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DataModelConditionList.UpdateList(LeftSideSelectionViewModel.DataModelPath);
|
DataModelConditionList.UpdateList(LeftSideSelectionViewModel.DataModelPath);
|
||||||
_profileEditorService.UpdateSelectedProfileElement();
|
_profileEditorService.UpdateSelectedProfileElement();
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
LeftSideSelectionViewModel.ChangeDataModelPath(DataModelConditionList.ListPath);
|
LeftSideSelectionViewModel.ChangeDataModelPath(DataModelConditionList.ListPath);
|
||||||
@ -127,6 +131,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
childViewModel.Update();
|
childViewModel.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialActivate()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
base.OnInitialActivate();
|
||||||
|
}
|
||||||
|
|
||||||
private void LeftSideSelectionViewModelOnPropertySelected(object? sender, DataModelInputDynamicEventArgs e)
|
private void LeftSideSelectionViewModelOnPropertySelected(object? sender, DataModelInputDynamicEventArgs e)
|
||||||
{
|
{
|
||||||
ApplyList();
|
ApplyList();
|
||||||
|
|||||||
@ -12,7 +12,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
public class DataModelConditionEventPredicateViewModel : DataModelConditionPredicateViewModel
|
public class DataModelConditionEventPredicateViewModel : DataModelConditionPredicateViewModel
|
||||||
{
|
{
|
||||||
private readonly IDataModelUIService _dataModelUIService;
|
private readonly IDataModelUIService _dataModelUIService;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
|
||||||
|
|
||||||
public DataModelConditionEventPredicateViewModel(DataModelConditionEventPredicate dataModelConditionEventPredicate,
|
public DataModelConditionEventPredicateViewModel(DataModelConditionEventPredicate dataModelConditionEventPredicate,
|
||||||
IProfileEditorService profileEditorService,
|
IProfileEditorService profileEditorService,
|
||||||
@ -21,11 +20,9 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
ISettingsService settingsService)
|
ISettingsService settingsService)
|
||||||
: base(dataModelConditionEventPredicate, profileEditorService, dataModelUIService, conditionOperatorService, settingsService)
|
: base(dataModelConditionEventPredicate, profileEditorService, dataModelUIService, conditionOperatorService, settingsService)
|
||||||
{
|
{
|
||||||
_profileEditorService = profileEditorService;
|
|
||||||
_dataModelUIService = dataModelUIService;
|
_dataModelUIService = dataModelUIService;
|
||||||
|
|
||||||
LeftSideColor = new SolidColorBrush(Color.FromRgb(185, 164, 10));
|
LeftSideColor = new SolidColorBrush(Color.FromRgb(185, 164, 10));
|
||||||
Initialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataModelConditionEventPredicate DataModelConditionEventPredicate => (DataModelConditionEventPredicate) Model;
|
public DataModelConditionEventPredicate DataModelConditionEventPredicate => (DataModelConditionEventPredicate) Model;
|
||||||
@ -38,6 +35,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
LeftSideSelectionViewModel.ChangeDataModel(eventDataModel);
|
LeftSideSelectionViewModel.ChangeDataModel(eventDataModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialActivate()
|
||||||
|
{
|
||||||
|
base.OnInitialActivate();
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
protected override List<Type> GetSupportedInputTypes()
|
protected override List<Type> GetSupportedInputTypes()
|
||||||
{
|
{
|
||||||
IReadOnlyCollection<DataModelVisualizationRegistration> editors = _dataModelUIService.RegisteredDataModelEditors;
|
IReadOnlyCollection<DataModelVisualizationRegistration> editors = _dataModelUIService.RegisteredDataModelEditors;
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
<materialDesign:PackIcon Kind="Close" Width="18" Height="18" />
|
<materialDesign:PackIcon Kind="Close" Width="18" Height="18" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- Left side, may be null for primitive lists -->
|
<!-- Left side, always a property -->
|
||||||
<ContentControl Grid.Row="0"
|
<ContentControl Grid.Row="0"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
s:View.Model="{Binding LeftSideSelectionViewModel}"
|
s:View.Model="{Binding LeftSideSelectionViewModel}"
|
||||||
|
|||||||
@ -4,7 +4,6 @@ using System.Linq;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.UI.Exceptions;
|
|
||||||
using Artemis.UI.Shared;
|
using Artemis.UI.Shared;
|
||||||
using Artemis.UI.Shared.Services;
|
using Artemis.UI.Shared.Services;
|
||||||
|
|
||||||
@ -13,8 +12,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
public class DataModelConditionListPredicateViewModel : DataModelConditionPredicateViewModel
|
public class DataModelConditionListPredicateViewModel : DataModelConditionPredicateViewModel
|
||||||
{
|
{
|
||||||
private readonly IDataModelUIService _dataModelUIService;
|
private readonly IDataModelUIService _dataModelUIService;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
|
||||||
private bool _isPrimitiveList;
|
|
||||||
|
|
||||||
public DataModelConditionListPredicateViewModel(DataModelConditionListPredicate dataModelConditionListPredicate,
|
public DataModelConditionListPredicateViewModel(DataModelConditionListPredicate dataModelConditionListPredicate,
|
||||||
IProfileEditorService profileEditorService,
|
IProfileEditorService profileEditorService,
|
||||||
@ -23,11 +20,9 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
ISettingsService settingsService)
|
ISettingsService settingsService)
|
||||||
: base(dataModelConditionListPredicate, profileEditorService, dataModelUIService, conditionOperatorService, settingsService)
|
: base(dataModelConditionListPredicate, profileEditorService, dataModelUIService, conditionOperatorService, settingsService)
|
||||||
{
|
{
|
||||||
_profileEditorService = profileEditorService;
|
|
||||||
_dataModelUIService = dataModelUIService;
|
_dataModelUIService = dataModelUIService;
|
||||||
|
|
||||||
LeftSideColor = new SolidColorBrush(Color.FromRgb(71, 108, 188));
|
LeftSideColor = new SolidColorBrush(Color.FromRgb(71, 108, 188));
|
||||||
Initialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataModelConditionListPredicate DataModelConditionListPredicate => (DataModelConditionListPredicate) Model;
|
public DataModelConditionListPredicate DataModelConditionListPredicate => (DataModelConditionListPredicate) Model;
|
||||||
@ -37,14 +32,20 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
DataModelPropertiesViewModel listDataModel = GetListDataModel();
|
DataModelPropertiesViewModel listDataModel = GetListDataModel();
|
||||||
if (listDataModel.Children.Count == 1 && listDataModel.Children.First() is DataModelListPropertyViewModel)
|
LeftSideSelectionViewModel.ChangeDataModel(listDataModel);
|
||||||
_isPrimitiveList = true;
|
|
||||||
else
|
|
||||||
_isPrimitiveList = false;
|
|
||||||
|
|
||||||
// Get the data models
|
// If this is a primitive list the user doesn't have much to choose, so preselect the list item for them
|
||||||
if (!_isPrimitiveList)
|
if (DataModelConditionListPredicate.DataModelConditionList.IsPrimitiveList && DataModelConditionListPredicate.LeftPath == null)
|
||||||
LeftSideSelectionViewModel.ChangeDataModel(listDataModel);
|
{
|
||||||
|
DataModelConditionListPredicate.UpdateLeftSide(listDataModel.Children.FirstOrDefault()?.DataModelPath);
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialActivate()
|
||||||
|
{
|
||||||
|
base.OnInitialActivate();
|
||||||
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<Type> GetSupportedInputTypes()
|
protected override List<Type> GetSupportedInputTypes()
|
||||||
@ -72,16 +73,11 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
|
|
||||||
private DataModelPropertiesViewModel GetListDataModel()
|
private DataModelPropertiesViewModel GetListDataModel()
|
||||||
{
|
{
|
||||||
if (DataModelConditionListPredicate.DataModelConditionList.ListPath?.DataModelGuid == null)
|
ListPredicateWrapperDataModel wrapper = ListPredicateWrapperDataModel.Create(
|
||||||
throw new ArtemisUIException("Failed to retrieve the list data model VM for this list predicate because it has no list path");
|
DataModelConditionListPredicate.DataModelConditionList.ListType
|
||||||
|
|
||||||
DataModelPropertiesViewModel dataModel = _dataModelUIService.GetPluginDataModelVisualization(_profileEditorService.GetCurrentModule(), true);
|
|
||||||
DataModelListViewModel listDataModel = (DataModelListViewModel) dataModel.GetChildByPath(
|
|
||||||
DataModelConditionListPredicate.DataModelConditionList.ListPath.DataModelGuid.Value,
|
|
||||||
DataModelConditionListPredicate.DataModelConditionList.ListPath.Path
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return listDataModel.GetListTypeViewModel(_dataModelUIService);
|
return wrapper.CreateViewModel(_dataModelUIService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user