3
WPF 프로젝트에 Prism 4와 MEF를 사용하고 있습니다. 디렉토리에서로드해야하는 DLL이 있습니다. 이 DLL은 IGame에을 통해 IModule를 구현하고 적절하게 형성된다 (또는 적어도 난 그렇게 생각) : DirectoryModuleCatalog를 작동시키는 방법은 무엇입니까?
[Module(ModuleName = "SnakeModule")]
class SnakeModule : IGame
{
public void Initialize()
{
Console.WriteLine("test");
}
public void StartGame()
{
throw new NotImplementedException();
}
}
현재, 주요 프로젝트는 컴파일되지만 모듈은 초기화되지 않습니다. 부트 스트 래퍼를 설치하는 방법을 이해하는 데 어려움이 있습니다. 설명서는
DirectoryModuleCatalog으로 전체 예제가 없기 때문에별로 도움이되지 않습니다. 모듈성 빠른 시작도 컴파일되지 않습니다. 다음은 부트 스트 래퍼입니다.
class BootStrap : MefBootstrapper
{
protected override DependencyObject CreateShell()
{
return ServiceLocator.Current.GetInstance<Shell>();
}
protected override void InitializeShell()
{
Application.Current.MainWindow = (Window)this.Shell;
Application.Current.MainWindow.Show();
}
protected override void ConfigureAggregateCatalog()
{
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(BootStrap).Assembly));
}
protected override IModuleCatalog CreateModuleCatalog()
{
DirectoryModuleCatalog catalog = new DirectoryModuleCatalog() { ModulePath = @"..\..\..\GameTestLib\bin\Debug" };
return catalog;
}
protected override void ConfigureContainer()
{
base.ConfigureContainer();
}
}
경로가 정확합니다. 요약하면, 제 질문은 : 부트 스트 래퍼를 어떻게 설정해야합니까?