Plugins - Simplified and streamlined the way plugins provide VMs

Plugins - Added dependency injection to all plugin VMs
Plugin settings - Allow injecting plugin settings into any class defined in the plugin assembly
This commit is contained in:
Robert committed 2020-08-21 11:14:53 +02:00
1 parent aa3c3d6b95
commit c71faba2c9
29 files changed
+349 -165

No files matched your search

@@ -1,9 +1,12 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Plugins.Abstract.ViewModels;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Screens.ProfileEditor.Dialogs;
using Artemis.UI.Screens.ProfileEditor.LayerProperties.Abstract;
using Artemis.UI.Shared.Services.Interfaces;
using Ninject;
using Ninject.Parameters;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
@@ -12,16 +15,22 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
{
private readonly IDialogService _dialogService;
private readonly IWindowManager _windowManager;
private readonly IKernel _kernel;
private readonly IRenderElementService _renderElementService;
private readonly IProfileEditorService _profileEditorService;
public TreePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel,
IProfileEditorService profileEditorService, IRenderElementService renderElementService, IDialogService dialogService, IWindowManager windowManager)
IProfileEditorService profileEditorService,
IRenderElementService renderElementService,
IDialogService dialogService,
IWindowManager windowManager,
IKernel kernel)
{
_profileEditorService = profileEditorService;
_renderElementService = renderElementService;
_dialogService = dialogService;
_windowManager = windowManager;
_kernel = kernel;
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
}
@@ -29,11 +38,15 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
public void OpenBrushSettings()
{
var configurationViewModel = LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.ConfigurationDialog;
if (configurationViewModel == null)
return;
try
{
var configurationViewModel = LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush.GetConfigurationViewModel();
if (configurationViewModel != null)
_windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(configurationViewModel));
var layerBrush = new ConstructorArgument("layerBrush", LayerPropertyGroupViewModel.LayerPropertyGroup.LayerBrush);
var viewModel = (BrushConfigurationViewModel) _kernel.Get(configurationViewModel.Type, layerBrush);
_windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(viewModel));
}
catch (Exception e)
{
@@ -44,11 +57,15 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
public void OpenEffectSettings()
{
var configurationViewModel = LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.ConfigurationDialog;
if (configurationViewModel == null)
return;
try
{
var configurationViewModel = LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.GetConfigurationViewModel();
if (configurationViewModel != null)
_windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(configurationViewModel));
var layerEffect = new ConstructorArgument("layerEffect", LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect);
var viewModel = (EffectConfigurationViewModel) _kernel.Get(configurationViewModel.Type, layerEffect);
_windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(viewModel));
}
catch (Exception e)
{