Rolling back to NETCF v1.0 from 2.0+

So on a little side project I am working on, I realized that I needed to roll back to .NET Compact Framework (NETCF) v1.0 from a newer version. Why, you might ask? Well, it seems that even on my fairly recent Windows Mobile 5 XV6700 HTC Apache/Mogul whatever (only 2 years old, hey now), that not even NETCF v2 is available. Now you can always just install NETCF 2 or 3.5, but those take up 5+ MB of precious space on your device. Even worse, when you start even the simplest app, your RAM usage can balloon to 3-4 MB with just a few simple controls.

Using the built-in NETCF (v1.0-ish) can help reduce those issues dramatically.

I was never able to figure out how to create a new NETCF v1.0 project in Visual Studio 2005, so I went back and installed VS 2003. Created the project, then opened it in VS2005 and added all of my old files. I need to use VS2005 because I am using Vista x64 and the device emulator in VS2003 doesn’t work in that environment it seems (drivers wouldn’t load). It is also my understanding that you can’t move forward to VS2008 either, that you are forced to upgrade the framework version.

So once I got my files included, I tried to compile. Ooops! Quite a few problems I had to fix popped up.

  • The shorthand for property get/set (get; set;) didn’t work. I had to go back and redo all of my properties that used this. There is still a ‘prop<tab><tab>’ helper though.
  • My resources were all messed up. I had to basically rebuild my forms from scratch, then copy in all of the stuff from the newer NETCF versions. I took the opportunity to simply move a lot of my resources into a skin folder and just load them at runtime with FileStream and Bitmap.
  • I had a splash page that was just another form, and used TopMost to make sure it was on top. This isn’t available in NETCF v1, and it really isn’t clear to me at all how control paint ordering occurs by default. BringToFront/SendToBack didn’t really do much for me, and the order of creation of the controls didn’t help either. There is supposed to be a way to do this with SetWindowPos.
  • List<string>-style templates aren’t available, or anything from System.Collections.Generic. You need to use ArrayList or similar instead, and some occasional casting from object.
  • The MenuItem.Tag(and Tag from other controls) is missing, which is where you store your user data for menu controls. For instance you might create a list view of files, and each file would have a Tag object containing its FileInfo object. You have to come up with another solution here, like keeping track of the order/array of MenuItems, unless I figure something else out.
  • Enum.Parse isn’t available.

It seems a lot of these problems can be solved by using the OpenNETCF Smartphone Device Framework v1.4. For instance EnumEx.Parse is available in that framework addition.

Posted by slaingod Tue, 26 Feb 2008 20:29:00 GMT