In yesterday's post, I mentioned the new .NET CF 3.5 property, SystemSettings.Platform. As part of the post I provided a short code snippet that showed using the property to determine if a device is Windows Mobile Professional device (Pocket PC-style) or Windows Mobile Standard device (Smartphone-style).
I realized this morning that the snippet is not quite complete because it assumes that a SystemSettings.Platform value of WinCEPlatform.PocketPC indicates a Windows Mobile Professional device. This isn't quite accurate because to be a Windows Mobile Professional device, the device must also have a phone.
So here's the more complete version of yesterday's code snippet.
if (SystemSettings.Platform == WinCEPlatform.PocketPC)
txtDeviceType.Text = "Windows Mobile " +
(SystemState.PhoneRadioPresent ? "Professional" : "Classic");
else if (SystemSettings.Platform == WinCEPlatform.Smartphone)
txtDeviceType.Text = "Windows Mobile Standard";
else
txtDeviceType.Text = "Not Windows Mobile";
The solution is pretty simple, just add the SystemState.PhoneRadioPresent check to see if the device has a phone radio - if it does, it's a Professional device; if not, it's a Classic device.
Just one quick note when performing the Professional vs. Classic device checks using the Windows Mobile Professional emulator...
You may find that when you run this code on the Windows Mobile Professional emulator, that SystemState.PhoneRadioPresent returns false. If this happens, be sure that you have the Windows Mobile Professional emulator connected to the Cellular Emulator. The reason that you need the Cellular Emulator is because the Cellular Emulator emulates the device's cellular radio. People sometimes think of it as simply emulating a cellular connection but it's much more; it emulates the actual cellular radio.
Posted
Dec 21 2007, 11:43 AM
by
jim-wilson