Search code examples
c#.netwindows-mobilecompact-framework

Windows Mobile- only keeping one form open. Best design question


So I would consider myself a .Net and ASP.NET pro but I am a bit new to Windows Mobile (I am targeting .net 3.5 CF and Windows Mobile 6).

I am creating a data driven application that will have 3-4 tables. I have created a form for each table that allows the user to search through the table.

Each form inheretes from the Main form so that they each have the same Menu.

My question is how do I make sure that only one Window is open. I want to allow the user to go to the menu and choose a table which will open a new form. What I don't want is for the user to open say each form and then when they are done to have to close 3 or 4 windows. Is this possible? If so how do I do it? On a side note is there a better way to do this. I don't want all my logic on one form. So I don't just want to hide and show and panels.


Solution

  • I keep something I call an application hub that everything goes though.

    So each menu click will call the applciation hub, and each form will reference it.

    Then, when switching form, the application hub needs to keep track of the current form, close it, then load the requested form.

    This isn't much code to write, and performs well.

    Or...performance wise, keep the application hub idea, and keep the dialogs open. It will perform better that way, rather than having to reload the forms all the time.

    Then on shut down, the application hub can check which forms are open (it should have a reference to each running form) and close them for the user.