C#とWPFでPRISMを使用してアプリケーションを開発しています。私はこれに不慣れで、プレゼンターを実装したいと思います。基本的に、モジュールにビューではなくプレゼンターを登録したいと思います。
現在、モジュールの初期化で次のことを行っています。
iRegionManager.RegisterViewWithRegion("MainRegion", typeof(AboutWindow));
プレゼンターが欲しいのですが、モジュールにプレゼンターを登録します。このプレゼンターは、私の地域の見解を示す責任があります。
いくつかの記事や例を読んでみましたが、欲しいものを正確に得ることができませんでした。
私の要件の擬似コードは次のとおりです。
public class AboutModule : IAboutModule
{
IRegionManager iRegionManager = null;
IUnityContainer container = null;
public AboutModule(IRegionManager iRegionManager, IUnityContainer container)
{
this.iRegionManager = iRegionManager;
this.container = container;
}
public void Initialize()
{
//Register my presenter here.
}
}
internal class AboutModulePresenter : IAboutModulePresenter
{
private IAboutModuleView iAboutModuleView = null;
internal AboutModulePresenter(IAboutModuleView iAboutModuleView)
{
this.iAboutModuleView = iAboutModuleView;
}
public IAboutModuleView View
{
get
{
return this.iAboutModuleView;
}
}
public void ShowView()
{
//Register my view with region manager and display in the region.
}
}