Mar 4, 2011 at 9:32 AM
Edited Mar 4, 2011 at 4:28 PM
|
Hi
I'm loading plug-ins using mef into my caliburn application. I want all Plug-ins with a UI elements to follow the same caliburn architecture an implement the presenter class where appropiate.
To Load these Plug-ins i'm doing something Like in my App class
private DirectoryCatalog plugins;
protected override Assembly[] SelectAssemblies()
{
var assemblies = new List<Assembly> { Assembly.GetExecutingAssembly() };
foreach (var assemblyName in plugins.LoadedFiles)
{
assemblies.Add(Assembly.LoadFrom(assemblyName));
}
return assemblies.ToArray();
}
protected override IServiceLocator CreateContainer()
{
var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
var pluginDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Plugins";
plugins = new DirectoryCatalog(pluginDirectory);
catalog.Catalogs.Add(plugins);
this.container = new CompositionContainer(catalog);
return new MEFAdapter(this.container);
}
This i would think loads my plug-ins and my current app.
When i show one of my ViewModels from my plugin in a PresenterManager i get the following error "A default view was not found for...."
Is this the correct way to load plug-ins?
Cheers,
theHaggis
|