| 

.NET C# Java Javascript Exception

3
Ich habe das Problem, das ich mein Modul in einem Prism Projekt nicht geladen bekomme, wenn ich versuche dieses dynamisch aus einem Verzeichnis zu laden.

Mein Bootstrapper.

public class Bootstrapper : UnityBootstrapper
{
protected override System.Windows.DependencyObject CreateShell()
{
return this.Container.Resolve<Shell>();
}

protected override void InitializeShell()
{
base.InitializeShell();

App.Current.MainWindow = (Window)this.Shell;
App.Current.MainWindow.Show();
}

protected override IModuleCatalog CreateModuleCatalog()
{
DirectoryModuleCatalog catalog = new DirectoryModuleCatalog();
catalog.ModulePath = @".\DirectoryModules";
return catalog;
}
}

Das Verzeichnis ist vorhanden und meine Modul Dll liegt auch vor.

Meine Shell:
<Window x:Class="Prism.Shell.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="http://www.codeplex.com/prism"
Title="Shell" Height="300" Width="300">
<StackPanel>
<TextBlock Text="Hello from Shell" />
<ItemsControl prism:RegionManager.RegionName="MainRegion"/>
</StackPanel>
</Window>

mein Modul:
[Module(ModuleName = "ModuleA", OnDemand = true)]
public class ModuleA : IModule
{
private readonly IRegionManager _regionManager;
public ModuleA(IRegionManager regionManager)
{
this._regionManager = regionManager;
}
public void Initialize()
{
_regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.MainRegionView));
}
}

Meine View im Modul
<UserControl x:Class="Prism.Views.MainRegionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<TextBlock Text="Hello from Module A" />
</Grid>
</UserControl>


Referenziere ich mein Modul und lade dieses direkt im Code (Bootstrapper),
Type moduleType = typeof(ModuleA);
IModuleCatalog catalog = new ModuleCatalog();

catalog.AddModule(
new ModuleInfo()
{
ModuleName = moduleType.FullName,
ModuleType = moduleType.AssemblyQualifiedName
});

wird das Modul auch angezeigt.

Beim dynamischen Laden der Module aus einem Verzeichnis leider nicht. Was übersehe ich?
31.05.2011
Mario Priebe 5,8k 2 9
Besteht das Problem immer noch? Ich verwende den Mef als Bootstrapper, und bei diesem funktioniert dies wunderbar. Gruß
smartic 16.02.2012