Display conditions - Implemented lists in the core, UI needs more work

This commit is contained in:
Robert committed 2020-08-12 17:22:43 +02:00
1 parent cd02a422fe
commit c0e1e60e5e
13 files changed
+288 -84

No files matched your search

@@ -3,7 +3,6 @@ using System.Collections;
using System.Reflection;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins.Abstract.DataModels;
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using Artemis.UI.Shared.Services;
using Stylet;
@@ -26,12 +25,6 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
set => SetAndNotify(ref _list, value);
}
public DataModelVisualizationViewModel ListTypePropertyViewModel
{
get => _listTypePropertyViewModel;
set => SetAndNotify(ref _listTypePropertyViewModel, value);
}
public BindableCollection<DataModelVisualizationViewModel> ListChildren { get; set; }
public string Count
@@ -40,6 +33,30 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
set => SetAndNotify(ref _count, value);
}
public DataModelPropertiesViewModel GetListTypeViewModel(IDataModelVisualizationService dataModelVisualizationService)
{
// Create a property VM describing the type of the list
var viewModel = CreateListChild(dataModelVisualizationService, List.GetType().GenericTypeArguments[0]);
// Put an empty value into the list type property view model
if (viewModel is DataModelListPropertiesViewModel dataModelListClassViewModel)
{
dataModelListClassViewModel.DisplayValue = Activator.CreateInstance(dataModelListClassViewModel.ListType);
dataModelListClassViewModel.Update(dataModelVisualizationService);
return dataModelListClassViewModel;
}
if (viewModel is DataModelListPropertyViewModel dataModelListPropertyViewModel)
{
dataModelListPropertyViewModel.DisplayValue = Activator.CreateInstance(dataModelListPropertyViewModel.ListType);
var wrapper = new DataModelPropertiesViewModel(null,null,null);
wrapper.Children.Add(dataModelListPropertyViewModel);
return wrapper;
}
return null;
}
public override void Update(IDataModelVisualizationService dataModelVisualizationService)
{
if (Parent != null && !Parent.IsVisualizationExpanded)
@@ -49,20 +66,6 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
if (List == null)
return;
if (ListTypePropertyViewModel == null)
{
// Create a property VM describing the type of the list
ListTypePropertyViewModel = CreateListChild(dataModelVisualizationService, List.GetType().GenericTypeArguments[0]);
// Put an empty value into the list type property view model
if (ListTypePropertyViewModel is DataModelListPropertiesViewModel dataModelListClassViewModel)
dataModelListClassViewModel.DisplayValue = Activator.CreateInstance(dataModelListClassViewModel.ListType);
else if (ListTypePropertyViewModel is DataModelListPropertyViewModel dataModelListPropertyViewModel)
dataModelListPropertyViewModel.DisplayValue = Activator.CreateInstance(dataModelListPropertyViewModel.ListType);
ListTypePropertyViewModel.Update(dataModelVisualizationService);
}
var index = 0;
foreach (var item in List)
{