Jaa


Determine OS versions and which GDR updates are installed on WP8 and WP7

In Windows Phone development, you'll often need to know at run-time exactly which version of Windows Phone your application is running on.  To make this easier, feel free to use this static class below which provides you exactly which GDRs are installed and which version of the OS you're running on. If you don't want to use the class below, know this...

WP7.5 version = Less than Windows Phone 7.10.8858
WP7.8 version = Windows Phone 7.10.8858 or greater but less than 8.0.0
WP8.0 version = Windows Phone 8.x.x (obviously)
WP8 GDR1 version = Windows Phone 8.0.10211 or greater
WP8 GDR2 version = Windows Phone 8.0.10322 or greater
WP8 GDR3 version = Windows Phone 8.0.10492 or greater

public static class OperatingSystem
{
       private static Version VersionNumberForWP78 = new Version(7, 10, 8858);
       private static Version VersionNumberForWP80GDR1 = new Version(8, 0, 10211);
       private static Version VersionNumberForWP80GDR2 = new Version(8, 0, 10322);
       private static Version VersionNumberForWP80GDR3 = new Version(8, 0, 10492); 

       public static bool IsWP75 { get { return Environment.OSVersion.Version < VersionNumberForWP78; } }
       public static bool IsWP78 { get { return Environment.OSVersion.Version >= VersionNumberForWP78 && Environment.OSVersion.Version.Major < 8; } }
       public static bool IsWP80 { get { return Environment.OSVersion.Version.Major >= 8; } }

       public static bool HasGDR1 { get { return Environment.OSVersion.Version >= VersionNumberForWP80GDR1; } }
       public static bool HasGDR2 { get { return Environment.OSVersion.Version >= VersionNumberForWP80GDR2; } }
       public static bool HasGDR3 { get { return Environment.OSVersion.Version >= VersionNumberForWP80GDR3; } }
}