views:

41

answers:

2

Hi

This is a bit embarrasing but I'm not sure of the standard way to design a Windows Mobile Winforms application. Most of my experience is in Asp.NET. In particular what is the normal way to navigate between screens? I guess one way would be to have one "main" screen and open any other forms as modal dialogs. Another way would be to instantiate the new form and call .Show() then call .Hide() on the parent form. I can't seem to find an example of the best approach. The application will have a lot of forms and it doesn't really have a single "main" form. Any advice to point me in the right direction would be appreciated. Ideally I would like a complex example Windows Mobile C# Winforms app with quite a lot of forms. All the examples seem to have just one or two forms.

Cheers Mark

+1  A: 

The application will have a lot of forms

Don't load the whole forms at one time to avoid overloading your memory which can make your application and/or phone slower.

Use a Mainform (maybe invisible?) and show the other forms over this one.

cevik
I forget, load the other forms at usage and unload them when you finished...
cevik
Thanks for the suggestion cevik. I think ctacke's approach is probably the correct one but it's a bit too hard for me at this stage so I will probably follow your suggestion until I learn more.CheersMark
Mark Evans
A: 

I'm not sure you're going to find any sample with a whole lot of Forms. More forms means more complexity, and a sample, by nature, tries to be simple. That doesn't mean you can't extend the ideas in a sample to cover complex cases.

For UI, I personally like to use a dependency injection and inversion of control container to hold all of my class instances, and use an MVC/MVP pattern to separate the presentation from the logic. At that point showing different forms (which is the "V" in MVC) is really dependent on how you need to present you data. Sometimes the data makes sense as tabs in a Form (think of a settings dialog maybe), sometimes modal dialogs make sense (though not very often), sometime a Form stack makes sense. Usually you have some sort of hybrid that uses a little of all of them.

ctacke
Hi ctackeI think that I should be sending you 10% of my pay! Thanks so much for further help. I'm a bit out of my depth here. I checked out your dependency injection framework. Your documentation is quite clear and I have some understanding of it but I think it's a bit too difficult for me at this stage. I'm just making a prototype initially so I'll muddle through with one "main" form that contains references to any other forms that have been instatiated. No doubt I'll come back to this issue once I learn more and understand the limitations of this approach. Thanks again.CheersMark
Mark Evans