Navigating from one form to another
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 w开发者_运维知识库ould 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
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.
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.
精彩评论