I am developing an application using PRISM in C# and WPF. I am new to this and would like to implement the Presenter. Basically, I would like to register a Presenter instead of View in my Module.
At present I am doing the following in my Module Initialize:
iRegionManager.RegisterViewWithRegion("MainRegion", typeof(AboutWindow));
What I would like is I want to have a presenter, I will register presenter in my module. This presenter must be responsible to show the view in my region.
I tried reading several articles and examples but was not able to get exactly what I want.
Pseudo-code for my requirements is as follows:
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.
}
}