Tuesday, December 7, 2010

Windows Phone 7 Quick Tip #23 – Determine if you are running on the Emulator or a Device

When you are developing your Windows Phone 7 application you might want to know if you are running on an emulator or on the device.  Fortunately there’s a property for that:


It can have the values:


So a simple check of:

if(Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Device)
             MessageBox.Show(“On the emulator”);

will let you know that you are on the emulator.


No comments:

Post a Comment