mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 09:43:46 +00:00
Data model debugger - Added module filtering
Data model debugger - Added search input (disabled & not yet implemented) Data model debugger - Finished list support
This commit is contained in:
parent
58e07ae5bd
commit
8e01d1f63e
@ -64,6 +64,15 @@ namespace Artemis.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataModel GetPluginDataModel(Plugin plugin)
|
||||||
|
{
|
||||||
|
if (plugin is Module module)
|
||||||
|
return module.InternalDataModel;
|
||||||
|
if (plugin is BaseDataModelExpansion dataModelExpansion)
|
||||||
|
return dataModelExpansion.InternalDataModel;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void PluginServiceOnPluginEnabled(object sender, PluginEventArgs e)
|
private void PluginServiceOnPluginEnabled(object sender, PluginEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PluginInfo.Instance is Module module && module.InternalExpandsMainDataModel)
|
if (e.PluginInfo.Instance is Module module && module.InternalExpandsMainDataModel)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Artemis.Core.Models;
|
using Artemis.Core.Models;
|
||||||
|
using Artemis.Core.Plugins.Abstract;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||||
|
|
||||||
namespace Artemis.Core.Services.Interfaces
|
namespace Artemis.Core.Services.Interfaces
|
||||||
@ -19,5 +20,11 @@ namespace Artemis.Core.Services.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="baseDataModelExpansion"></param>
|
/// <param name="baseDataModelExpansion"></param>
|
||||||
void RemoveExpansion(DataModel baseDataModelExpansion);
|
void RemoveExpansion(DataModel baseDataModelExpansion);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If found, returns the data model of the provided plugin
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plugin">Should be a module with a data model or a data model expansion</param>
|
||||||
|
DataModel GetPluginDataModel(Plugin plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
foreach (var item in List)
|
foreach (var item in List)
|
||||||
{
|
{
|
||||||
DataModelVisualizationViewModel child;
|
DataModelVisualizationViewModel child;
|
||||||
if (Children.Count < index)
|
if (Children.Count <= index)
|
||||||
{
|
{
|
||||||
child = CreateChild(item);
|
child = CreateChild(item);
|
||||||
Children.Add(child);
|
Children.Add(child);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||||
|
|
||||||
namespace Artemis.UI.DataModelVisualization
|
namespace Artemis.UI.DataModelVisualization
|
||||||
@ -12,25 +11,13 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
Parent = parent;
|
Parent = parent;
|
||||||
PropertyDescription = propertyDescription;
|
PropertyDescription = propertyDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsListProperty { get; set; }
|
|
||||||
public string ListDescription { get; set; }
|
|
||||||
public Type PropertyType { get; set; }
|
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (PropertyInfo != null && Parent?.Model != null)
|
if (PropertyInfo != null && Parent?.Model != null)
|
||||||
{
|
|
||||||
IsListProperty = false;
|
|
||||||
Model = PropertyInfo.GetValue(Parent.Model);
|
Model = PropertyInfo.GetValue(Parent.Model);
|
||||||
PropertyType = PropertyInfo.PropertyType;
|
|
||||||
}
|
UpdateListStatus();
|
||||||
else if (Parent is DataModelListViewModel listViewModel)
|
|
||||||
{
|
|
||||||
IsListProperty = true;
|
|
||||||
ListDescription = $"List item [{listViewModel.List.IndexOf(Model)}]";
|
|
||||||
PropertyType = Model.GetType();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
|
||||||
using Artemis.Core.Extensions;
|
using Artemis.Core.Extensions;
|
||||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||||
using Humanizer;
|
|
||||||
using Stylet;
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.UI.DataModelVisualization
|
namespace Artemis.UI.DataModelVisualization
|
||||||
@ -45,6 +43,8 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
|
|
||||||
foreach (var dataModelVisualizationViewModel in Children)
|
foreach (var dataModelVisualizationViewModel in Children)
|
||||||
dataModelVisualizationViewModel.Update();
|
dataModelVisualizationViewModel.Update();
|
||||||
|
|
||||||
|
UpdateListStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,11 +10,16 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
{
|
{
|
||||||
public abstract class DataModelVisualizationViewModel : PropertyChangedBase
|
public abstract class DataModelVisualizationViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
public PropertyInfo PropertyInfo { get; protected set; }
|
|
||||||
public DataModelPropertyAttribute PropertyDescription { get; protected set; }
|
public DataModelPropertyAttribute PropertyDescription { get; protected set; }
|
||||||
|
public PropertyInfo PropertyInfo { get; protected set; }
|
||||||
|
public Type PropertyType { get; set; }
|
||||||
|
|
||||||
public DataModelVisualizationViewModel Parent { get; protected set; }
|
public DataModelVisualizationViewModel Parent { get; protected set; }
|
||||||
public object Model { get; set; }
|
public object Model { get; set; }
|
||||||
|
|
||||||
|
public bool IsListProperty { get; set; }
|
||||||
|
public string ListDescription { get; set; }
|
||||||
|
|
||||||
public abstract void Update();
|
public abstract void Update();
|
||||||
|
|
||||||
protected DataModelVisualizationViewModel CreateChild(PropertyInfo propertyInfo)
|
protected DataModelVisualizationViewModel CreateChild(PropertyInfo propertyInfo)
|
||||||
@ -59,5 +64,20 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void UpdateListStatus()
|
||||||
|
{
|
||||||
|
if (Parent is DataModelListViewModel listViewModel)
|
||||||
|
{
|
||||||
|
IsListProperty = true;
|
||||||
|
ListDescription = $"List item [{listViewModel.List.IndexOf(Model)}]";
|
||||||
|
PropertyType = Model.GetType();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsListProperty = false;
|
||||||
|
PropertyType = PropertyInfo?.PropertyType;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,16 +8,74 @@
|
|||||||
xmlns:s="https://github.com/canton7/Stylet"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
xmlns:converters="clr-namespace:Artemis.UI.Converters"
|
xmlns:converters="clr-namespace:Artemis.UI.Converters"
|
||||||
xmlns:wpf="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:wpf="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:plugins="clr-namespace:Artemis.Core.Plugins.Abstract;assembly=Artemis.Core"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:DataModelDebugViewModel}">
|
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:DataModelDebugViewModel}">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<TreeView ItemsSource="{Binding MainDataModel.Children}" HorizontalContentAlignment="Stretch">
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0" Margin="0 0 0 5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="0.5*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="0.5*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<!-- Property searching (nyi) -->
|
||||||
|
<wpf:PackIcon Grid.Column="0" Kind="Search" VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Column="1" wpf:HintAssist.Hint="Search property" VerticalAlignment="Center" Margin="5 0" IsEnabled="False"/>
|
||||||
|
|
||||||
|
<!-- Module filtering -->
|
||||||
|
<TextBlock Grid.Column="3" VerticalAlignment="Center">Filter module</TextBlock>
|
||||||
|
<ToggleButton Grid.Column="4"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Margin="5 0"
|
||||||
|
Style="{StaticResource MaterialDesignSwitchToggleButton}"
|
||||||
|
IsChecked="{Binding IsModuleFilterEnabled}" />
|
||||||
|
<ComboBox Grid.Column="5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
wpf:HintAssist.Hint="Select a module"
|
||||||
|
IsEditable="True"
|
||||||
|
TextSearch.TextPath="DisplayName"
|
||||||
|
Margin="5 0 0 0"
|
||||||
|
IsEnabled="{Binding IsModuleFilterEnabled}"
|
||||||
|
SelectedItem="{Binding SelectedModule}"
|
||||||
|
ItemsSource="{Binding Modules}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel d:DataContext="{d:DesignInstance Type=plugins:Module}" Orientation="Horizontal">
|
||||||
|
<wpf:PackIcon Kind="{Binding DisplayIcon}" VerticalAlignment="Center" Margin="0 0 5 0"/>
|
||||||
|
<TextBlock Text="{Binding DisplayName}" VerticalAlignment="Center"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</Grid>
|
||||||
|
<TreeView Grid.Row="1" ItemsSource="{Binding MainDataModel.Children}" HorizontalContentAlignment="Stretch">
|
||||||
<TreeView.Resources>
|
<TreeView.Resources>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelViewModel}" ItemsSource="{Binding Children}">
|
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelViewModel}" ItemsSource="{Binding Children}">
|
||||||
<TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
|
<Grid>
|
||||||
|
<TextBlock Text="{Binding PropertyDescription.Name}"
|
||||||
|
ToolTip="{Binding PropertyDescription.Description}"
|
||||||
|
Visibility="{Binding IsListProperty, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}" />
|
||||||
|
<Grid Visibility="{Binding IsListProperty, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Margin="0 0 5 0" FontWeight="Bold">
|
||||||
|
<Run>[</Run><Run Text="{Binding PropertyType.Name, Mode=OneWay}" /><Run>]</Run>
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding ListDescription}" ToolTip="{Binding PropertyDescription.Description}" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelListViewModel}" ItemsSource="{Binding Children}">
|
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelListViewModel}" ItemsSource="{Binding Children}">
|
||||||
<Grid>
|
<Grid>
|
||||||
@ -30,10 +88,10 @@
|
|||||||
[List]
|
[List]
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
|
<TextBlock Grid.Column="1" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
|
||||||
<TextBlock Grid.Column="2"
|
<TextBlock Grid.Column="2"
|
||||||
Text="{Binding Count, Mode=OneWay}"
|
Text="{Binding Count, Mode=OneWay}"
|
||||||
FontFamily="Consolas"
|
FontFamily="Consolas"
|
||||||
HorizontalAlignment="Right"/>
|
HorizontalAlignment="Right" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
|
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
|
||||||
@ -47,24 +105,24 @@
|
|||||||
<Run>[</Run><Run Text="{Binding PropertyType.Name, Mode=OneWay}" /><Run>]</Run>
|
<Run>[</Run><Run Text="{Binding PropertyType.Name, Mode=OneWay}" /><Run>]</Run>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
Text="{Binding PropertyDescription.Name}"
|
Text="{Binding PropertyDescription.Name}"
|
||||||
ToolTip="{Binding PropertyDescription.Description}"
|
ToolTip="{Binding PropertyDescription.Description}"
|
||||||
Visibility="{Binding IsListProperty, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}"/>
|
Visibility="{Binding IsListProperty, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}" />
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock Grid.Column="1"
|
||||||
Text="{Binding ListDescription}"
|
Text="{Binding ListDescription}"
|
||||||
ToolTip="{Binding PropertyDescription.Description}"
|
ToolTip="{Binding PropertyDescription.Description}"
|
||||||
Visibility="{Binding IsListProperty, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"/>
|
Visibility="{Binding IsListProperty, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||||
<TextBlock Grid.Column="2"
|
<TextBlock Grid.Column="2"
|
||||||
Text="{Binding Model, Mode=OneWay}"
|
Text="{Binding Model, Mode=OneWay}"
|
||||||
FontFamily="Consolas"
|
FontFamily="Consolas"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Visibility="{Binding Model, Converter={StaticResource NullToVisibilityConverter}}"/>
|
Visibility="{Binding Model, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||||
<TextBlock Grid.Column="2"
|
<TextBlock Grid.Column="2"
|
||||||
Text="null"
|
Text="null"
|
||||||
FontFamily="Consolas"
|
FontFamily="Consolas"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}"
|
Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}"
|
||||||
Visibility="{Binding Model, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}"/>
|
Visibility="{Binding Model, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
</TreeView.Resources>
|
</TreeView.Resources>
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
using System.Timers;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Timers;
|
||||||
|
using Artemis.Core.Events;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
using Artemis.UI.DataModelVisualization;
|
using Artemis.UI.DataModelVisualization;
|
||||||
using Artemis.UI.Services;
|
using Artemis.UI.Services;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
@ -8,11 +12,15 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
|||||||
public class DataModelDebugViewModel : Screen
|
public class DataModelDebugViewModel : Screen
|
||||||
{
|
{
|
||||||
private readonly IDataModelVisualizationService _dataModelVisualizationService;
|
private readonly IDataModelVisualizationService _dataModelVisualizationService;
|
||||||
|
private readonly IPluginService _pluginService;
|
||||||
private readonly Timer _updateTimer;
|
private readonly Timer _updateTimer;
|
||||||
|
private bool _isModuleFilterEnabled;
|
||||||
|
private Core.Plugins.Abstract.Module _selectedModule;
|
||||||
|
|
||||||
public DataModelDebugViewModel(IDataModelVisualizationService dataModelVisualizationService)
|
public DataModelDebugViewModel(IDataModelVisualizationService dataModelVisualizationService, IPluginService pluginService)
|
||||||
{
|
{
|
||||||
_dataModelVisualizationService = dataModelVisualizationService;
|
_dataModelVisualizationService = dataModelVisualizationService;
|
||||||
|
_pluginService = pluginService;
|
||||||
_updateTimer = new Timer(500);
|
_updateTimer = new Timer(500);
|
||||||
_updateTimer.Elapsed += (sender, args) => MainDataModel.Update();
|
_updateTimer.Elapsed += (sender, args) => MainDataModel.Update();
|
||||||
|
|
||||||
@ -21,15 +29,65 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
|||||||
|
|
||||||
public DataModelViewModel MainDataModel { get; set; }
|
public DataModelViewModel MainDataModel { get; set; }
|
||||||
|
|
||||||
|
public string PropertySearch { get; set; }
|
||||||
|
public List<Core.Plugins.Abstract.Module> Modules { get; set; }
|
||||||
|
|
||||||
|
public Core.Plugins.Abstract.Module SelectedModule
|
||||||
|
{
|
||||||
|
get => _selectedModule;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedModule = value;
|
||||||
|
GetDataModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsModuleFilterEnabled
|
||||||
|
{
|
||||||
|
get => _isModuleFilterEnabled;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_isModuleFilterEnabled = value;
|
||||||
|
|
||||||
|
if (!IsModuleFilterEnabled)
|
||||||
|
SelectedModule = null;
|
||||||
|
else
|
||||||
|
GetDataModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
{
|
{
|
||||||
MainDataModel = _dataModelVisualizationService.GetMainDataModelVisualization();
|
GetDataModel();
|
||||||
_updateTimer.Start();
|
_updateTimer.Start();
|
||||||
|
_pluginService.PluginEnabled += PluginServiceOnPluginToggled;
|
||||||
|
_pluginService.PluginDisabled += PluginServiceOnPluginToggled;
|
||||||
|
|
||||||
|
PopulateModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDeactivate()
|
protected override void OnDeactivate()
|
||||||
{
|
{
|
||||||
_updateTimer.Stop();
|
_updateTimer.Stop();
|
||||||
|
_pluginService.PluginEnabled -= PluginServiceOnPluginToggled;
|
||||||
|
_pluginService.PluginDisabled -= PluginServiceOnPluginToggled;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetDataModel()
|
||||||
|
{
|
||||||
|
MainDataModel = SelectedModule != null
|
||||||
|
? _dataModelVisualizationService.GetPluginDataModelVisualization(SelectedModule)
|
||||||
|
: _dataModelVisualizationService.GetMainDataModelVisualization();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PluginServiceOnPluginToggled(object? sender, PluginEventArgs e)
|
||||||
|
{
|
||||||
|
PopulateModules();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PopulateModules()
|
||||||
|
{
|
||||||
|
Modules = _pluginService.GetPluginsOfType<Core.Plugins.Abstract.Module>().Where(p => p.Enabled).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Plugins.Abstract;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
using Artemis.UI.DataModelVisualization;
|
using Artemis.UI.DataModelVisualization;
|
||||||
using Artemis.UI.Services.Interfaces;
|
using Artemis.UI.Services.Interfaces;
|
||||||
|
|
||||||
@ -17,14 +18,26 @@ namespace Artemis.UI.Services
|
|||||||
{
|
{
|
||||||
var viewModel = new DataModelViewModel();
|
var viewModel = new DataModelViewModel();
|
||||||
foreach (var dataModelExpansion in _dataModelService.DataModelExpansions)
|
foreach (var dataModelExpansion in _dataModelService.DataModelExpansions)
|
||||||
viewModel.Children.Add(new DataModelViewModel(null,dataModelExpansion, dataModelExpansion.DataModelDescription, viewModel));
|
viewModel.Children.Add(new DataModelViewModel(null, dataModelExpansion, dataModelExpansion.DataModelDescription, viewModel));
|
||||||
|
|
||||||
return viewModel;
|
return viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataModelViewModel GetPluginDataModelVisualization(Plugin plugin)
|
||||||
|
{
|
||||||
|
var dataModel = _dataModelService.GetPluginDataModel(plugin);
|
||||||
|
if (dataModel == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var viewModel = new DataModelViewModel();
|
||||||
|
viewModel.Children.Add(new DataModelViewModel(null, dataModel, dataModel.DataModelDescription, viewModel));
|
||||||
|
return viewModel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IDataModelVisualizationService : IArtemisUIService
|
public interface IDataModelVisualizationService : IArtemisUIService
|
||||||
{
|
{
|
||||||
public DataModelViewModel GetMainDataModelVisualization();
|
DataModelViewModel GetMainDataModelVisualization();
|
||||||
|
DataModelViewModel GetPluginDataModelVisualization(Plugin plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,7 +31,6 @@ namespace Artemis.Plugins.Modules.General
|
|||||||
|
|
||||||
DataModel.IntsList[0] = _rand.Next();
|
DataModel.IntsList[0] = _rand.Next();
|
||||||
DataModel.IntsList[2] = _rand.Next();
|
DataModel.IntsList[2] = _rand.Next();
|
||||||
|
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user