This is a tiny little quick-tip for Windows Phone 7
I came up with a tiny little function to make it easy to check whether you’re running under the Windows Phone Emulator this afternoon.
1 2 3 4 5 6 7 8 9 10 11 | Public Function IsEmulator() As Boolean Select Case Microsoft.Devices.Environment.DeviceType Case Microsoft.Devices.DeviceType.Device Return False Case Microsoft.Devices.DeviceType.Emulator Return True Case Else '---- just a fall back case Return True End Select End Function |
It’s trivial really, I know, but I often wrap these kinds of utility functions in an easy-to-remember function name, because remembering “Microsoft.Devices.Environment.DeviceType” is a lot more difficult than “IsEmulator” <g>.