Atm in my application I do like this:
class Bootstrapper : UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
return Container.Resolve<Shell>();
}
protected override void InitializeShell()
{
base.InitializeShell();
App.Current.MainWindow = (Window)Shell;
App.Current.MainWindow.Show();
}
protected override void ConfigureModuleCatalog()
{
base.ConfigureModuleCatalog();
var moduleCatalog = (ModuleCatalog)ModuleCatalog;
moduleCatalog.AddModule(typeof(FooModule));
moduleCatalog.AddModule(typeof(BarModule));
}
}
I would like to load FooModule and BarModule by indicating the path to the dll file, something like this:
protected override void ConfigureModuleCatalog()
{
...
var assembly = Assembly.LoadFrom(@"libs\FooLib.dll");
var type = assembly.GetType("FooLib.FooModule");
moduleCatalog.AddModule(type);
...
}
but it doesn't work, I get this error message on Bootstrapper.Run() :
There is currently no moduleTypeLoader in the ModuleManager that can retrieve the specified module.
EDIT: this is my FooModule:
public class FooModule : IModule
{
private readonly IRegionViewRegistry _regionViewRegistry;
public FooModule(IRegionViewRegistry registry)
{
_regionViewRegistry = registry;
}
public void Initialize()
{
_regionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(Main));
}
}
I think Prism v4 Loading modules on demand with DirectoryModuleCatalog could help.
UPDATE:
Sorry, just realized that reference mentioned above won't help.
Try this one from msdn - "Loading Modules on Demand" section, I think that's what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With