Data model - Added data model visualization view model

Debugger - Split debugger into different tabs
Debugger - Added data model debugger
This commit is contained in:
SpoinkyNL committed 2020-06-29 00:22:16 +02:00
1 parent 1bc8d65237
commit 98ec26304a
33 files changed
+565 -236

No files matched your search

@@ -1,11 +1,15 @@
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using System.Reflection;
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using Stylet;
namespace Artemis.UI.DataModelVisualization
{
public abstract class DataModelVisualizationViewModel : PropertyChangedBase
{
public PropertyInfo PropertyInfo { get; protected set; }
public DataModelPropertyAttribute PropertyDescription { get; protected set; }
public DataModelViewModel Parent { get; protected set; }
public abstract void Update();
}
}
@@ -1,23 +1,39 @@
using System.Reflection;
using System;
using System.Linq.Expressions;
using System.Reflection;
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using FastMember;
namespace Artemis.UI.DataModelVisualization
{
public class DataModelPropertyViewModel : DataModelVisualizationViewModel
public class DataModelPropertyViewModel<T, TP> : DataModelPropertyViewModel
{
private readonly ObjectAccessor _accessor;
private readonly Func<T, TP> _expression;
public DataModelPropertyViewModel(PropertyInfo propertyInfo, DataModelPropertyAttribute propertyDescription, DataModelViewModel parent)
{
_accessor = ObjectAccessor.Create(parent.Model);
PropertyInfo = propertyInfo;
Parent = parent;
PropertyDescription = propertyDescription;
var instance = Expression.Parameter(typeof(T), "instance");
var body = Expression.Property(instance, propertyInfo);
_expression = Expression.Lambda<Func<T, TP>>(body, instance).Compile();
}
public PropertyInfo PropertyInfo { get; }
public object Value => _accessor[PropertyInfo.Name];
public TP Value
{
get => BaseValue is TP value ? value : default;
set => BaseValue = value;
}
public override void Update()
{
Value = _expression((T) Parent.Model);
}
}
public abstract class DataModelPropertyViewModel : DataModelVisualizationViewModel
{
public object BaseValue { get; protected set; }
}
}
@@ -1,4 +1,6 @@
using System;
using System.Reflection;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using Humanizer;
using Stylet;
@@ -12,8 +14,9 @@ namespace Artemis.UI.DataModelVisualization
Children = new BindableCollection<DataModelVisualizationViewModel>();
}
public DataModelViewModel(object model, DataModelPropertyAttribute propertyDescription, DataModelViewModel parent)
public DataModelViewModel(PropertyInfo propertyInfo, object model, DataModelPropertyAttribute propertyDescription, DataModelViewModel parent)
{
PropertyInfo = propertyInfo;
Model = model;
PropertyDescription = propertyDescription;
Parent = parent;
@@ -22,7 +25,7 @@ namespace Artemis.UI.DataModelVisualization
PopulateProperties();
}
public object Model { get; }
public object Model { get; private set; }
public BindableCollection<DataModelVisualizationViewModel> Children { get; set; }
public void PopulateProperties()
@@ -39,21 +42,34 @@ namespace Artemis.UI.DataModelVisualization
if (dataModelPropertyAttribute == null)
dataModelPropertyAttribute = new DataModelPropertyAttribute {Name = propertyInfo.Name.Humanize()};
// For value types create a child view model if the value type is not null
if (propertyInfo.PropertyType.IsValueType)
// For primitives, create a property view model, it may be null that is fine
if (propertyInfo.PropertyType.IsPrimitive || propertyInfo.PropertyType == typeof(string))
{
// This may be slower than avoiding generics and Activator.CreateInstance but it allows for expression trees inside the VM we're creating
// here, this means slow creation but fast updates after that
var viewModelType = typeof(DataModelPropertyViewModel<,>).MakeGenericType(Model.GetType(), propertyInfo.PropertyType);
var viewModel = (DataModelVisualizationViewModel) Activator.CreateInstance(viewModelType, propertyInfo, dataModelPropertyAttribute, this);
Children.Add(viewModel);
}
// For other value types create a child view model if the value type is not null
else if (propertyInfo.PropertyType.IsClass || propertyInfo.PropertyType.IsStruct())
{
var value = propertyInfo.GetValue(Model);
if (value == null)
continue;
Children.Add(new DataModelViewModel(value, dataModelPropertyAttribute, this));
}
// For primitives, create a property view model, it may be null that is fine
else if (propertyInfo.PropertyType.IsPrimitive)
{
Children.Add(new DataModelPropertyViewModel(propertyInfo, dataModelPropertyAttribute, this));
Children.Add(new DataModelViewModel(propertyInfo, value, dataModelPropertyAttribute, this));
}
}
}
public override void Update()
{
if (PropertyInfo != null && PropertyInfo.PropertyType.IsStruct())
Model = PropertyInfo.GetValue(Parent.Model);
foreach (var dataModelVisualizationViewModel in Children)
dataModelVisualizationViewModel.Update();
}
}
}
@@ -27,39 +27,26 @@
<mde:AppBar.AppIcon>
<materialDesign:PackIcon Kind="Matrix" Width="20" Height="28" />
</mde:AppBar.AppIcon>
<materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
<StackPanel>
<Button Content="Force garbage collection" Command="{s:Action ForceGarbageCollection}"/>
<Button Content="Force garbage collection" Command="{s:Action ForceGarbageCollection}" />
</StackPanel>
</materialDesign:PopupBox>
</mde:AppBar>
<StackPanel Margin="10, 10, 10, 10">
<TextBlock TextWrapping="Wrap">
In this window you can view the inner workings of Artemis.
Please note that having this window open can have a performance impact on your system.
</TextBlock>
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0">
This image shows what is being rendered and dispatched to RGB.NET
</TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,5,0" FontWeight="Bold">
FPS:
</TextBlock>
<TextBlock Grid.Column="2" HorizontalAlignment="Right" Text="{Binding CurrentFps}" />
</Grid>
<materialDesign:Card VerticalAlignment="Stretch" Margin="0, 5,0,0">
<Image Source="{Binding CurrentFrame}" />
</materialDesign:Card>
</StackPanel>
<TabControl ItemsSource="{Binding Items}"
SelectedItem="{Binding ActiveItem}"
DisplayMemberPath="DisplayName"
Style="{StaticResource MaterialDesignTabControl}">
<TabControl.ContentTemplate>
<DataTemplate>
<materialDesign:TransitioningContent OpeningEffect="{materialDesign:TransitionEffect FadeIn}">
<ContentControl s:View.Model="{Binding}" TextElement.Foreground="{DynamicResource MaterialDesignBody}" Margin="10" />
</materialDesign:TransitioningContent>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</DockPanel>
</mde:MaterialWindow>
@@ -1,33 +1,19 @@
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using SkiaSharp;
using SkiaSharp.Views.WPF;
using Artemis.UI.Screens.Settings.Debug.Tabs;
using Stylet;
namespace Artemis.UI.Screens.Settings.Debug
{
public class DebugViewModel : Screen
public class DebugViewModel : Conductor<Screen>.Collection.OneActive
{
private readonly ICoreService _coreService;
private readonly IRgbService _rgbService;
public DebugViewModel(ICoreService coreService, IRgbService rgbService, ISurfaceService surfaceService)
public DebugViewModel(RenderDebugViewModel renderDebugViewModel, DataModelDebugViewModel dataModelDebugViewModel, LogsDebugViewModel logsDebugViewModel)
{
_coreService = coreService;
_rgbService = rgbService;
surfaceService.SurfaceConfigurationUpdated += (sender, args) => Execute.PostToUIThread(() => CurrentFrame = null);
surfaceService.ActiveSurfaceConfigurationSelected += (sender, args) => Execute.PostToUIThread(() => CurrentFrame = null);
Items.Add(renderDebugViewModel);
Items.Add(dataModelDebugViewModel);
Items.Add(logsDebugViewModel);
ActiveItem = renderDebugViewModel;
}
public ImageSource CurrentFrame { get; set; }
public double CurrentFps { get; set; }
public string Title => "Debugger";
public void ForceGarbageCollection()
@@ -36,59 +22,5 @@ namespace Artemis.UI.Screens.Settings.Debug
GC.WaitForPendingFinalizers();
GC.Collect();
}
protected override void OnInitialActivate()
{
_coreService.FrameRendered += CoreServiceOnFrameRendered;
_coreService.FrameRendering += CoreServiceOnFrameRendering;
base.OnInitialActivate();
}
protected override void OnClose()
{
_coreService.FrameRendered -= CoreServiceOnFrameRendered;
_coreService.FrameRendering -= CoreServiceOnFrameRendering;
base.OnClose();
}
private void CoreServiceOnFrameRendered(object sender, FrameRenderedEventArgs e)
{
Execute.PostToUIThread(() =>
{
if (e.BitmapBrush?.Bitmap == null)
return;
if (!(CurrentFrame is WriteableBitmap writeableBitmap))
{
CurrentFrame = e.BitmapBrush.Bitmap.ToWriteableBitmap();
return;
}
try
{
using (var skiaImage = SKImage.FromPixels(e.BitmapBrush.Bitmap.PeekPixels()))
{
var info = new SKImageInfo(skiaImage.Width, skiaImage.Height);
writeableBitmap.Lock();
using (var pixmap = new SKPixmap(info, writeableBitmap.BackBuffer, writeableBitmap.BackBufferStride))
{
skiaImage.ReadPixels(pixmap, 0, 0);
}
writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight));
writeableBitmap.Unlock();
}
}
catch (AccessViolationException)
{
// oops
}
});
}
private void CoreServiceOnFrameRendering(object sender, FrameRenderingEventArgs e)
{
CurrentFps = Math.Round(1.0 / e.DeltaTime, 2);
}
}
}
@@ -0,0 +1,49 @@
<UserControl x:Class="Artemis.UI.Screens.Settings.Debug.Tabs.DataModelDebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Debug.Tabs"
xmlns:dataModel="clr-namespace:Artemis.UI.DataModelVisualization"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
xmlns:wpf="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:DataModelDebugViewModel}">
<UserControl.Resources>
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
</UserControl.Resources>
<Grid>
<TreeView ItemsSource="{Binding MainDataModel.Children}" HorizontalContentAlignment="Stretch">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelViewModel}" ItemsSource="{Binding Children}">
<TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Margin="0 0 5 0" FontWeight="Bold">
<Run>[</Run><Run Text="{Binding PropertyInfo.PropertyType.Name, Mode=OneWay}" /><Run>]</Run>
</TextBlock>
<TextBlock Grid.Column="1" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
<TextBlock Grid.Column="2"
Text="{Binding Value, Mode=OneWay}"
FontFamily="Consolas"
HorizontalAlignment="Right"
Visibility="{Binding Value, Converter={StaticResource NullToVisibilityConverter}}"/>
<TextBlock Grid.Column="2"
Text="null"
FontFamily="Consolas"
HorizontalAlignment="Right"
Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}"
Visibility="{Binding Value, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}"/>
</Grid>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
</Grid>
</UserControl>
@@ -0,0 +1,35 @@
using System.Timers;
using Artemis.UI.DataModelVisualization;
using Artemis.UI.Services;
using Stylet;
namespace Artemis.UI.Screens.Settings.Debug.Tabs
{
public class DataModelDebugViewModel : Screen
{
private readonly IDataModelVisualizationService _dataModelVisualizationService;
private readonly Timer _updateTimer;
public DataModelDebugViewModel(IDataModelVisualizationService dataModelVisualizationService)
{
_dataModelVisualizationService = dataModelVisualizationService;
_updateTimer = new Timer(500);
_updateTimer.Elapsed += (sender, args) => MainDataModel.Update();
DisplayName = "Data model";
}
public DataModelViewModel MainDataModel { get; set; }
protected override void OnActivate()
{
MainDataModel = _dataModelVisualizationService.GetMainDataModelVisualization();
_updateTimer.Start();
}
protected override void OnDeactivate()
{
_updateTimer.Stop();
}
}
}
@@ -0,0 +1,12 @@
<UserControl x:Class="Artemis.UI.Screens.Settings.Debug.Tabs.LogsDebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Debug.Tabs"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:LogsDebugViewModel}">
<Grid>
</Grid>
</UserControl>
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Artemis.UI.Screens.Settings.Debug.Tabs
{
/// <summary>
/// Interaction logic for LogsDebugView.xaml
/// </summary>
public partial class LogsDebugView : UserControl
{
public LogsDebugView()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using Stylet;
namespace Artemis.UI.Screens.Settings.Debug.Tabs
{
public class LogsDebugViewModel : Screen
{
public LogsDebugViewModel()
{
DisplayName = "Logs";
}
}
}
@@ -0,0 +1,35 @@
<UserControl x:Class="Artemis.UI.Screens.Settings.Debug.Tabs.RenderDebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Debug.Tabs"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:RenderDebugViewModel}">
<StackPanel>
<TextBlock TextWrapping="Wrap">
In this window you can view the inner workings of Artemis.
Please note that having this window open can have a performance impact on your system.
</TextBlock>
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0">
This image shows what is being rendered and dispatched to RGB.NET
</TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,5,0" FontWeight="Bold">
FPS:
</TextBlock>
<TextBlock Grid.Column="2" HorizontalAlignment="Right" Text="{Binding CurrentFps}" />
</Grid>
<materialDesign:Card VerticalAlignment="Stretch" Margin="0, 5,0,0">
<Image Source="{Binding CurrentFrame}" />
</materialDesign:Card>
</StackPanel>
</UserControl>
@@ -0,0 +1,86 @@
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using SkiaSharp;
using SkiaSharp.Views.WPF;
using Stylet;
namespace Artemis.UI.Screens.Settings.Debug.Tabs
{
public class RenderDebugViewModel : Screen
{
private readonly ICoreService _coreService;
private readonly IRgbService _rgbService;
private readonly ISurfaceService _surfaceService;
public RenderDebugViewModel(ICoreService coreService, IRgbService rgbService, ISurfaceService surfaceService)
{
_coreService = coreService;
_rgbService = rgbService;
_surfaceService = surfaceService;
DisplayName = "Rendering";
}
public ImageSource CurrentFrame { get; set; }
public double CurrentFps { get; set; }
protected override void OnActivate()
{
_coreService.FrameRendered += CoreServiceOnFrameRendered;
_coreService.FrameRendering += CoreServiceOnFrameRendering;
base.OnActivate();
}
protected override void OnDeactivate()
{
_coreService.FrameRendered -= CoreServiceOnFrameRendered;
_coreService.FrameRendering -= CoreServiceOnFrameRendering;
base.OnDeactivate();
}
private void CoreServiceOnFrameRendered(object sender, FrameRenderedEventArgs e)
{
Execute.PostToUIThread(() =>
{
if (e.BitmapBrush?.Bitmap == null)
return;
if (!(CurrentFrame is WriteableBitmap writeableBitmap))
{
CurrentFrame = e.BitmapBrush.Bitmap.ToWriteableBitmap();
return;
}
try
{
using (var skiaImage = SKImage.FromPixels(e.BitmapBrush.Bitmap.PeekPixels()))
{
var info = new SKImageInfo(skiaImage.Width, skiaImage.Height);
writeableBitmap.Lock();
using (var pixmap = new SKPixmap(info, writeableBitmap.BackBuffer, writeableBitmap.BackBufferStride))
{
skiaImage.ReadPixels(pixmap, 0, 0);
}
writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight));
writeableBitmap.Unlock();
}
}
catch (AccessViolationException)
{
// oops
}
});
}
private void CoreServiceOnFrameRendering(object sender, FrameRenderingEventArgs e)
{
CurrentFps = Math.Round(1.0 / e.DeltaTime, 2);
}
}
}
@@ -46,15 +46,19 @@
<materialDesign:PackIcon Kind="{Binding Icon}" Width="48" Height="48" Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Center" />
<TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource MaterialDesignTextBlock}" Text="{Binding PluginInfo.Name}" />
<materialDesign:Card Grid.Column="2" Grid.Row="0"
Background="#FF4343"
Foreground="White"
Height="22"
Padding="4"
Margin="0 -18 0 0"
Visibility="{Binding DisplayLoadFailed, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
LOAD FAILED
</materialDesign:Card>
<Button Grid.Column="2" Grid.Row="0"
Background="#FF4343"
BorderBrush="#FF7474"
Foreground="White"
Height="22"
Padding="4"
Margin="0 -18 0 0"
Visibility="{Binding DisplayLoadFailed, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
Style="{StaticResource MaterialDesignRaisedButton}"
ToolTip="Click to see the full error that occured"
Command="{s:Action ShowLoadException}">
<TextBlock FontSize="11">LOAD FAILED</TextBlock>
</Button>
<TextBlock Grid.Column="1"
Grid.Row="1"
@@ -66,7 +70,7 @@
</Grid>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
<Button Style="{StaticResource MaterialDesignOutlinedButton}" ToolTip="MaterialDesignOutlinedButton" Margin="4" s:View.ActionTarget="{Binding}" Command="{s:Action OpenSettings}">
<Button Style="{StaticResource MaterialDesignOutlinedButton}" ToolTip="MaterialDesignOutlinedButton" Margin="4" Command="{s:Action OpenSettings}">
SETTINGS
</Button>
</StackPanel>
@@ -32,23 +32,18 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
public Plugin Plugin { get; set; }
public PluginInfo PluginInfo { get; set; }
public string Type => Plugin.GetType().BaseType?.Name ?? Plugin.GetType().Name;
public bool Enabling { get; set; }
public PackIconKind Icon => GetIconKind();
public string Type => Plugin.GetType().BaseType?.Name ?? Plugin.GetType().Name;
public bool CanOpenSettings => IsEnabled && Plugin.HasConfigurationViewModel;
public bool DisplayLoadFailed => !Enabling && PluginInfo.LoadException != null;
public bool IsEnabled
{
get => PluginInfo.Enabled;
get => Plugin.Enabled;
set => Task.Run(() => UpdateEnabled(value));
}
public bool CanOpenSettings => IsEnabled && Plugin.HasConfigurationViewModel;
public bool Enabling { get; set; }
public bool DisplayLoadFailed => !Enabling && !PluginInfo.LastEnableSuccessful;
public async Task OpenSettings()
{
try
@@ -76,6 +71,14 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
}
}
public async Task ShowLoadException()
{
if (PluginInfo.LoadException == null)
return;
await _dialogService.ShowExceptionDialog("The plugin failed to load: " + PluginInfo.LoadException.Message, PluginInfo.LoadException);
}
private PackIconKind GetIconKind()
{
if (PluginInfo.Icon != null)
@@ -106,7 +109,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
private async Task UpdateEnabled(bool enable)
{
if (PluginInfo.Enabled == enable)
if (Plugin.Enabled == enable)
{
NotifyOfPropertyChange(nameof(IsEnabled));
return;
@@ -133,7 +136,6 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
try
{
_pluginService.EnablePlugin(Plugin);
_snackbarMessageQueue.Enqueue($"Enabled plugin {PluginInfo.Name}");
}
catch (Exception e)
{
@@ -17,7 +17,7 @@ namespace Artemis.UI.Services
{
var viewModel = new DataModelViewModel();
foreach (var dataModelExpansion in _dataModelService.DataModelExpansions)
viewModel.Children.Add(new DataModelViewModel(dataModelExpansion, dataModelExpansion.DataModelDescription, viewModel));
viewModel.Children.Add(new DataModelViewModel(null,dataModelExpansion, dataModelExpansion.DataModelDescription, viewModel));
return viewModel;
}