1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Artemis/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListPropertyViewModel.cs

47 lines
1.3 KiB
C#

using System;
using Artemis.Core;
using Artemis.Core.DataModelExpansions;
using Artemis.UI.Shared.Services;
namespace Artemis.UI.Shared
{
public class DataModelListPropertyViewModel : DataModelPropertyViewModel
{
private int _index;
private Type _listType;
public DataModelListPropertyViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, DataModelPath dataModelPath) : base(dataModel, parent, dataModelPath)
{
}
public int Index
{
get => _index;
set => SetAndNotify(ref _index, value);
}
public Type ListType
{
get => _listType;
set => SetAndNotify(ref _listType, value);
}
public override object GetCurrentValue()
{
return DisplayValue;
}
public override void Update(IDataModelUIService dataModelUIService)
{
// Display value gets updated by parent, don't do anything if it is null
if (DisplayValue == null)
return;
if (DisplayViewModel == null)
DisplayViewModel = dataModelUIService.GetDataModelDisplayViewModel(DisplayValue.GetType(), true);
ListType = DisplayValue.GetType();
UpdateDisplayParameters();
}
}
}