PnP on PPC2003

Sun, November 20, 2005, 03:55 AM under MobileAndEmbedded
It is always nice to see something you created being used by others. In this case I am referring to my MSDN article.

Udo Killermann sent me a project he wrote that use the P2PMessageQueue component to monitor device plug-n-play events.

You can also use the DeviceStatusMonitor in the SDF from OpenNETCF (guest,guest), which in v2 also uses the P2PMessageQueue, but Udo wanted a stand-alone example.

Download his project here, and any questions regarding the PnP project must be sent to 'udo dot killermann at web dot de' and not me!

Getting started with .NET Compact Framework development

Wed, November 16, 2005, 01:40 PM under MobileAndEmbedded
I meet a lot of experienced .NET developers lately (including colleagues) that have focused on WinForms or ASP.NET or other .NET areas, but have never dabbled with the .NET Compact Framework. It doesn't take long before out conversation ends up in me providing information on how to get started with NETCF development. Here goes for future reference

1. The very first thing to do is to install Visual Studio 2005 (it side by sides with earlier VS versions).
[ The Express editions are no good to you but Standard and above will do perfectly. There is also a stand alone SDK and you could even try Visual Studio.NET 2003 Professional or higher, but my advice is to get Visual Studio 2005. ]

2. (optional) If you are planning on targeting Windows Mobile 5.0 devices, then you also need to download the Windows Mobile 5.0 SDK (i.e. for SmartPhone and PocketPC). In this case, you also need to get ActiveSync v4 (install this *over* your existing ActiveSync v3).

3. Create a new project via the normal route, but choose the “Smart Device” node and then the appropriate self-explanatory project type (e.g. “Device Application”). Note that VS2005 also supports creating apps that target Compact Framework v1.0 (there never was a NETCF v1.1). I recommend you stick with the v2.0 projects.

4. Drag a button on the form and add an event handler to it as you normally would, and type: MessageBox.Show("It isn't that different, is it?").

5. Start debugging the application: note how you have to choose where to deploy your application (i.e. an emulator type), choose whatever you want (e.g. “Pocket PC 2003 SE Emulator” and then “Deploy”) and notice how your application runs and you can click the button to get your msgbox (this may take a few minutes if this is the first time you are deploying).

6. From the IDE, click the "Stop" to stop debugging your application (emulator remains running, but your application has exited).

7. (optional) There are also some platform considerations, read these

8. (optional) If you need to share/execute your CF code on the desktop, see this.

9. (optional) For some links on how the NETCF differs from the full framework, see here

10. (optional) Remember the netcf is not a strict subset

From here on, you can start developing that NETCF app you’ve always dreamed of :-)

You will run into issues and you will have questions. You are a smart guy/girl so, before you ask me for help, check that your question isn't already answered in the FAQ (old and new), search the netcf newsgroup via google and check that OpenNETCF hasn't addressed the limitation you face. If you still haven't got a resolution, now you can seek support. Luckily there is a vibrant netcf community and for NETCF v2 the MSDN forums rock.

Welcome to the world of mobile development. Isn’t it much more satisfying running your own creation on your pda/phone than on the desktop? The mobility space *will* take off big time in 2006. Good luck!

CF v2.0 on WinCE 4.2

Mon, November 14, 2005, 04:48 PM under MobileAndEmbedded
As you know, NETCF 2.0 supports WinCE 5.0, PocketPC 2003 and Windows Mobile 5.0 devices.

After much pressure on the fantastic netcf team, they have allowed a few of us to blog this exciting news:

Service Pack 1 of .NET Compact Framework v2.0 will offer support for custom Windows CE 4.2 devices:
• Runtime support only
• Support on all WinCE processor types

I can’t tell you anything else but if you have feedback/requests on this particular topic, log them at the product feedback center (ladybug). The NETCF team is listening!

Type vs Generics

Sun, November 13, 2005, 01:01 PM under dotNET
We are all familiar with the Type class of the framework and how useful it is in many scenarios. To obtain the Type of a type we can call GetType() on the instance, the static Type.GetType passing in the full name, or use C#'s typeOf operator (or GetType operator in VB).

We are also familiar with Generics (supported on NETCF as well).

At first there isn't much relation between the two. There are some cases, though, when you design an API (that depends on a type to be passed to it) where either of the two can satisfy your goal: A generic class or a class with a constructor accepting a Type. So in that case, which approach should you choose and why?

1. Blah<T>{...} //type declaration
2. Blah(Type t); //ctor

Just to be ultra-clear, the calling code for each occasion looks something like this:
1. new Blah<SomeType>();
2. new Blah(typeOf(SomeType));

Just FYI, and don't allow this to affect your thoughts, the indigo (or WCF if you prefer) team chose the 1st approach originally and then, after Beta 1, changed to the second. I am referring, of course, to the ServiceHost class. Why did they do that?

Since this blog doesn't have comments, reply on your own blog (or if you don't have one, feel free to email me your reply).

1) .NET design guidelines guru provides comments.
2) Ayende describes his preferences
3) Apparently, there is no mystery on the Indigo change:
"The ServiceHost just needs to know the type of the object being hosted - none of the methods or properties were accepting or returning the so the generic mechanism wasn't really being using per se."