Is it possible to develop the same application for Windows Phone 7 and Windows Mobile 6.x without much additional effort?

StackOverflow https://stackoverflow.com/questions/8602925

Question

I have to develop an application for Windows Mobile 6.x and version 7 and my skillset is .net and web based. Since version 7 is not backwards compatible I am thinking that I will end up with a lot of duplicate work.

I had a look at Rhomobile and Phonegap but the later does not support windows mobile 6.x and the former would require ruby knowledge.

I thought that I could have as much logic in class libraries as possible and then "include as link" the classes into projects so that they can be compiled for the specific platform. I feel like I may end up with a lot of #if PHONE7 style logic in that case and also the user interface code would have to be implemented for each platform.

What is the most efficient way to solve this problem?

Was it helpful?

Solution

If you can separate the UI from the logic you can begin to multi-target. The other consideration is the runtime of the phone (Silverlight 4?) and the phone sandboxing giving you limitations.

MVVM Light is multi-targeted and is open source, you could use this to review how they tackled it:

http://mvvmlight.codeplex.com/SourceControl/changeset/view/d546dc69fffd

In short though, your "add as link" idea is pretty much the basis of it.

The other question to ask is will the application fit on both platforms? The usage style from mobile to metro is a big change. People expect things to behave a certain way and look a certain way on metro. If you can confine this to the UI and move as much logic out as possible, then you should be ok. But there will come a point where it isn't worth sharing, it is simply easier to duplicate.

Sorry for a lack of detail in this answer, to be honest it is heavily app specific. I would personally start with separate applications and refactor as commonalities appear, using a combination of linked code files and hash defines.

A cute trick... you can always make the classes partial and have a partial code file for each hash define:

MyBusinessClass.CF.cs
MyBusinessClass.Silverlight.cs
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top