tags:

views:

39

answers:

1

The situation: MainForm (assigned to the MainPresenter) is up and running. The user click a ShowFoo button - an event is passed to the MainPresenter which in turn creates new FooPresenter and the FooView. How should I proceed now ? Where should the presenter be created and where should the view be created and most importantly, where should the MDIParent property be set ? (so fat I kind of think that should be done in the main view.

Notes: I am using a dependency framework, though that is quite irrelevant to the problem. Ideally I would like the IView to independent of the Form class.

+1  A: 

The way I would handle it have a funtion off of the MainPresenter interface that allows me to create a FooPresenter (as well as a Foo2Presenter, etc). THe MainPresenter has all the information inside of it to properly setup a child form of the MDI parent. Hence why it makes sense to have it there.

An alternative is to have a AppPresenters class that has the MainPresenter and the FooPresenter as properties or functions. Here the AppPresenters hold the presenter classes as well takes on the responsibility for tieing the forms together to have a proper MDI application. The implication of tihs approach is the fact the application is a master/parent form with a bunch of child forms is not reflected in the design of your interfaces.

The differences between the two approaches is minimal in my opinion. Both could be adapted to a different style of UI readily. So go which on makes better sense for you and your applicaiton.

RS Conley