Why do you think it is not practical to let the container handle the forms
lifecyle? I'm assuing thats what you mean when you say "do not let the DI
handle your Forms lifecyle"?
This is the whole point of using an IoC container - to separate concerns and
in this case abstract the management of forms from the developer. There are
containers that allow you to specify the licestyle - much like the popular
castle windsor. This is how I do it with a typical MVP pattern coupled with
the command pattern - works very well for mobile devices.
Execution always starts with the presenter which is loaded using the Service
Locator and from within a command, the view is then injected into the
presenter. So completly testable. Another nice bonus this architecture
gives, is the ability to add event aggregator pattern which can be used at
presenter level or form level and can be raised anywhere.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com
I would like to add that using a DI Framework works well (as it does
in general once you set it up), you should not let the DI handle your
Forms lifecycle. I am developing a wizard-style mobile application, in
which the user has to jump to a different form. I did write my own
Application Controller (pattern) for it. It takes care of lifecycle,
caching of forms etc. However, whenever there is a request for a Form
that has not been created yet, it retrieves it by quering my DI-
Container (which in that case acts as a Service Locator, but that one
is a special case in my application).
In strongly advocate for implementing one's own lyfecycle management
especially on a mobile device application where you use the same form
multiple times, because once loaded, the form will display much
faster.