I am wondering where to call the ShowDialog() in MVP pattern, Presenter is normally defined as:
public Presenter(IView view, IModel model)
{
this.View = view;
this.View.Presenter = this;
this.Model = model;
}
And I wanna show the View Modelly by calling ShowDialog(), then where should I call the ShowDialog()?
public void Foo()
{
var view = New View();
view.ShowDialog();
var presenter = new Presenter(view, model);
}
But if i call ShowDialog()
before the presenter is created, the .ShowDialog()
will not return before the view is closed,
then I have to call it in Presenter
, but i feel it anti-pattern to call ShowDialog()
in presenter,
So, what's the better solution or is it ok to call ShowDialog() in presenter?