Three properties that I use for almost every Windows Phone application
In this post I will tell you which three properties I use for almost
every one of my Windows Phone applications. The first property is used by me to
determine if the application is running in trial mode or full mode.
Second property is provided to identify if the application is running on
low-memory device and the last property is used to detect if user has
selected a dark or light background theme in Windows Phone settings. All
of those properties were described in detail earlier, but I have
decided to collect them in a single post.
Is it the trial version or full version?
A few months ago I wrote a post Determining license mode in Windows Phone 7 apps and below is a property taken from that post. You can simulate if application is running in Emulator in trial mode by modifying the “emulatorIsTrial” variable.
private const bool _emulatorIsTrial = false;
public bool IsTrialMode
{
get
{
if (Microsoft.Devices.Environment.DeviceType
== Microsoft.Devices.DeviceType.Emulator)
{
return _emulatorIsTrial;
}
return (new LicenseInformation().IsTrial());
}
}
Is it a low memory device?
To take advantage of devices that have more than 256 Mb of RAM available I have created a special property in one of my previous posts. This property helps you to determine the available memory on a device. Here’s what this property looks like:
private const bool _emulatorIsLowMemory = false;
public bool IsLowMemoryDevice
{
get
{
if (Microsoft.Devices.Environment.DeviceType
== Microsoft.Devices.DeviceType.Emulator)
{
return _emulatorIsLowMemory;
}
else
{
return (long)DeviceExtendedProperties.GetValue("DeviceTotalMemory")
<= 268435456;
}
}
}Is it a light or dark theme?
Finally, here is a property from my last post to detect if the user has selected a dark or light theme background in Windows Phone settings.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)





