Common C # Source Code for Windows and Windows Mobile

My goal is to create a user interface application that will work on both Windows Mobile and a regular Windows desktop. The priority is that it "looks good" under Windows Mobile, and for desktop Windows it is normal if it is distorted. Before investing days, I would like to hear where to start. There are several parts to this question:

  • Is the .NET Compact Framework a subset of the "normal" (please edit) .NET Framework? If not, does MSDN have any information anywhere in the classes that are in the .NET Compact Framework, but not in the "normal" (again, please edit) framework?

  • Is the behavior of common classes the same in both structures?

  • Is it possible to have one Visual Studio 2005 solution / project for both platforms? If so, how to do it?

  • Any other comments and tips? Any relevant links?

+6
c # winapi windows-mobile compact-framework
source share
5 answers
  • CF contains a subset of the full frame (FFx), but is not a pure subset. In fact, there are several things in CF that are not part of FFx, which makes it a bit more complicated. CF applications also, with the exception of the most basic cases, use P / Invoke. These calls are never the same from the desktop on the device, so they are not portable (although with a little abstraction you might have an interface with an agnostic platform).
  • For the most part, the behavior is the same. I saw some cases where it is not , and I remember that some event ordering was not always identical, so trust, but check.
  • This is possible due to very careful massaging of the configurations, but of course I do not recommend it. It is hard to maintain and very fragile. Instead, there are two project files: one for CF and one for FFx. In any case, you are likely to have a difference in the code files. Add the code files as links to each project so that they both use the same physical source file. I would recommend using some form of CI to ensure that they are both built at any time.
  • Take a look at Dan Moth's MSDN article and Code Asset Exchange Blog Entries .
+10
source share

PS I found a poster online - it will show you all the classes that are CF. I ordered it for Microsoft because Kinkos demanded $ 65 to print it in color for me! Microsoft sent me a couple of copies for free - all I had to do was ask:

http://www.microsoft.com/downloads/details.aspx?familyid=7B645F3A-6D22-4548-A0D8-C2A27E1917F8&displaylang=en

I have it hanging in my cabin, and this is a godsend when you try to remember which namespace classes can be found.

+6
source share

Good multi-part question:

  • Differences between Full Frame Platform and Compact Framework
  • The above article has links to related documentation on how class behavior is different (in some situations, it is definitely different)
  • Very simple! Create a single solution with a set of basic functions in the Class Library , then create two client projects (one for your desktop application and one for the windows mobile app). Finally, add links to the class library for both client projects.
  • Depending on the width of the project you are working on, you can check the Model View Controller template. This may not be much for your project, but if you want to share user interface behavior between projects, it can be a life saver.

Hope this helps!

+3
source share

CF typically contains a subset of classes from a regular structure, but you cannot directly execute code from one to another. In addition, instead of just being a subset, there may be a few things in a compact design that are not part of the regular version, such as mobile device-specific GUIs (soft keys, etc.) - provided what do you write exform winform, not a web page (this may be the easiest way to get compatibility).

With some effort, you can exchange logical code, in particular with dll utilities, but they need different csproj files (since they have completely different compilation goals). To reduce maintenance, you can often cheat by hacking csproj to use wildcards, for example here :

<ItemGroup> <Compile Include="..\protobuf-net\**\*.cs" /> </ItemGroup> 

For the user interface, things get a lot more complicated. In general, it would be expected to have a common business logic and a separate user interface for different target devices.

+2
source share

one). There is a compact framework, so yes; And this is a subset of the complete .NET platform. I have a poster on my wall in the office that indicates a whole bunch of classes that work in CF ... I donโ€™t think of my head if there are any pure CF, but I suppose there should be some. There are some good books on this subject - one of which is Paul Yao, and I have Andy Wigley, both available on Amazon.

2). As far as I know, CF and full framework classes work the same way, but they need to be compiled for different purposes.

3). I would venture to suggest that you only use classes that are common to both, that you can use the same solution. I donโ€™t know to what extent you have to go to compile it for a compact device and the full version, though, and I canโ€™t say with full confidence that this can be done. I would venture to suggest that the process is not simple.

4). Go to your local bookstore and browse through these two books that I mentioned. As I said, I have one Paul Yao, and it seems to cover most of what I could imagine on a compact device.

+1
source share

All Articles