Revisiting the Form Stack

Long, long ago I wrote an article for MSDN on creating a multi-Form CF application that used a Form Stack.  Since we all tend to grow and learn as developers, we find different ways to do things (and generally we scoff at code we wrote years before as inferior crap). 


Well Peter Nowak is giving a presentation of the OpenNETCF.IoC framework next week and I decided that a sample of using the UI elements of the library (Workspaces, SmartParts, etc) might be handy and so I decided to rewrite the Form Stack following my latest thinking.  Basically the idea is to allow a user to navigate through Forms (actually Views – you are separating your Views from the Model, right?) like you would on a browser.  You can move forward and back as well as “adding” to the end or top of the stack.  We also don’t want to be constantly creating new instances of the View classes because we like applications to perform well.


Here’s a look at the new application (yes, I know it’s “developer ugly” but this is about architecture, not aesthetics):



You can see the stack in the list, and our current position is noted by the asterisk.  “Fwd” will move down to View B, “Back” will move up to Form A, or you can push a new A or B onto the stack at the current location, which will truncate everything currently above (after) the current position.  Again, think of how your browser works.  It’s important to know, also, that there are only 3 total View instances created at this point (one of each specific type).


The code for this application is in source control over at the OpenNETCF.IoC Framework Codeplex site.  You’ll notice it’s called FormStackCS, hinting that there may be a FormStackVB coming.  If you’d like to volunteer to do that port, by all means let me know (meaning don’t hold your breath waiting for me to do it).

4 thoughts on “Revisiting the Form Stack”

  1. Hello Chris
    I am curious about you views on this subject as XAML based UI building comes into the mobile environment? A good view navigation strategy for views seems to be missing from WPF and silverlight( with alot of contenders but no clear winners).

    Also, although vector-based, it becomes easy to create a lot of controls with XAML. Do you think memory management is a problem and one of the reasons there is no XAML based UI to answer the IPhone?

    Is it possible to have more than one UI thread in Windows Mobile so that you can load views in the background? or at least (on app startup) to load a Login view that can be filled in while a "big" multi-panel/view loads in the background?

    Thanks
    Dave Kersnowski

    Like

  2. As far as the last part of the question,about usingmultiple UI threads, I found the answer: Yes you can. Maarten Struys did a good webcast on it.

    Thanks
    Dave Kersnowski

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s