Search code examples
c#windows-mobiledesign-patternshandheld

Developing for a Microsoft Embedded Handheld 6.5.3 device - architecture?


I'm about to start up a large project where the same database will be queried by three different applications/sources.

For the WPF I think I'll go with with MVVM pattern (or will MVP make more sense maybe?), but when it comes to the handheld device, I'm clueless as to which pattern/arcitecture to choose. Is it even possible to have some sort of arcitecture on such a device?

Anyone got any experience with this? :-)

Any help/hint is appreciated!

/ Bo


Solution

  • If you are planning to use Windows Mobile 6.5 along with the .NET Compact Framework 3.5 SP1 (in Visual Studio 2008), the most common approach is to use Windows Forms (Compact). If you are planning to use C++, you can ignore the rest of this answer as I'm not sure what the best practices are for C++.

    Windows Forms for .NET CF is similar to the full framework Windows Forms, but much more limited in functionality and out-of-the-box tools. There is really no WPF/Silverlight/MVVM options readily available for the legacy Windows Mobile platform, but you can try to roll your own MVVM type framework if you're brave, but I probably wouldn't suggest that as MVVM works better with WPF or Silverlight, and may not map to Windows Forms as well as other options.

    There are several MVC or MVP examples or basic frameworks out there for .NET CF Windows Forms, but I haven't seen one that's really full-featured. You could try the "Smart Client Software Factory" for Windows Mobile from the Patterns & Practices team at Microsoft, but I'm not sure I would go that route, as it can be overly complicated. Search google for "Windows Mobile MVC or MVP". A lot of times the MVC/MVP examples only show a single screen, which does not give you any idea how the author intends to handle application screen transitions, global events, etc.

    I would probably suggest the MVP pattern over MVC as MVP works well with Windows Forms. MVC can be a little awkward with Forms, unless you do it very carefully. This is the best example I've found of a multi-screen app on the Compact Framework using MVP in .NET CF:

    https://github.com/derickbailey/appcontroller.cf

    This is a great example, as it uses modern best practices like IoC and UI event aggregation. The other bonus of this example is that it sets the stage for good unit testing and good practices for UI development.