DeviceStatus deprecates DeviceExtendedProperties in Windows Phone 7.1 "mango"

mango-iheart

Windows Phone 7.1 SDK (mango) introduces the DeviceStatus class to the programmer. Microsoft.Phone.Info.DeviceStatus was introduced to replaced the deprecated DeviceExtendedProperties class from Windows Phone 7.0. DeviceStatus is meant to provide an easier to use API than the DeviceExtendedProperties. The DeviceStatus/DeviceProperties classes are useful for getting peeks inside the phone's hardware status.

For instance, to retrieve the device firmware version or the applications current memory usage using the DeviceStatus class we simply call the following.

System.Diagnostics.Debug.WriteLine( "firmware=" + Microsoft.Phone.Info.DeviceStatus.DeviceFirmwareVersion );
System.Diagnostics.Debug.WriteLine( "=" + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage.ToString("N") );

The code for using DeviceExtendedProperties was significantly, well, uglier. Observe what it took to get the DeviceFirmwareVersion to a string in the sample below. I think you'll agree the DeviceStatus class wraps up the call quite nicely compared to the barebones DeviceExtendedProperties.

object _prop;
Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue(@"ApplicationCurrentMemoryUsage", out _prop);
long _currentmemoryusage = (long)_prop;

object _prop2;
Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue(@"DeviceFirmwareVersion", out _prop2);
string _devicefirmwareversion = (string)_prop2;

Note there are full examples for the DeviceExtendedProperties class and the DeviceStatus class in the latest Windows Phone "Mango" Tacklebox on Devfish.net via the downloads section.  Direct URL is https://www.devfish.net/downloads/files/WP7TackleBox.zip  . Download the files, check out the samples, quit using DeviceExtendedProperties, and start using DeviceStatus.