Plugins - Gave each plugin its own child Ninject kernel

Plugins - Added support for validation in VMs
This commit is contained in:
Robert committed 2020-09-21 21:05:00 +02:00
1 parent 693ea29600
commit 2547b6a8bf
18 files changed
+132 -36

No files matched your search

@@ -58,7 +58,7 @@ namespace Artemis.UI.Shared.Services
return mainDataModel;
}
var dataModel = _dataModelService.GetPluginDataModel(plugin);
if (dataModel == null)
return null;
@@ -71,7 +71,7 @@ namespace Artemis.UI.Shared.Services
viewModel.UpdateRequested += (sender, args) => viewModel.Update(this);
return viewModel;
}
public DataModelVisualizationRegistration RegisterDataModelInput<T>(PluginInfo pluginInfo, IReadOnlyCollection<Type> compatibleConversionTypes = null) where T : DataModelInputViewModel
{
if (compatibleConversionTypes == null)
@@ -165,7 +165,7 @@ namespace Artemis.UI.Shared.Services
{
var match = _registeredDataModelDisplays.FirstOrDefault(d => d.SupportedType == propertyType);
if (match != null)
return (DataModelDisplayViewModel) _kernel.Get(match.ViewModelType);
return (DataModelDisplayViewModel) match.PluginInfo.Kernel.Get(match.ViewModelType);
return !fallBackToDefault ? null : _kernel.Get<DefaultDataModelDisplayViewModel>();
}
}
@@ -222,7 +222,7 @@ namespace Artemis.UI.Shared.Services
new ConstructorArgument("description", description),
new ConstructorArgument("initialValue", initialValue)
};
var viewModel = (DataModelInputViewModel) _kernel.Get(registration.ViewModelType, parameters);
var viewModel = (DataModelInputViewModel) registration.PluginInfo.Kernel.Get(registration.ViewModelType, parameters);
viewModel.CompatibleConversionTypes = registration.CompatibleConversionTypes;
return viewModel;
}
@@ -11,6 +11,7 @@ using Stylet;
namespace Artemis.UI.Shared.Services
{
// TODO: Become plugin-aware and use plugin kernel if injected into a plugin
internal class DialogService : IDialogService
{
private readonly IKernel _kernel;
@@ -273,7 +273,8 @@ namespace Artemis.UI.Shared.Services
return null;
var parameter = new ConstructorArgument("layerProperty", layerProperty);
return (PropertyInputViewModel<T>) Kernel.Get(viewModelType, parameter);
var kernel = registration != null ? registration.PluginInfo.Kernel : Kernel;
return (PropertyInputViewModel<T>) kernel.Get(viewModelType, parameter);
}
public ProfileModule GetCurrentModule()