Last active
January 25, 2016 00:21
-
-
Save Delaire/37cbe07738df34bfd5e8 to your computer and use it in GitHub Desktop.
How to find the device platform/type your Windows 10 application is running on
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DeviceTypeHelper | |
{ | |
public static DeviceTypeEnum GetDeviceType() | |
{ | |
switch (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily) | |
{ | |
case "Windows.Desktop": | |
return DeviceTypeEnum.Tablet; | |
case "Windows.Mobile": | |
return DeviceTypeEnum.Phone; | |
case "Windows.Universal": | |
return DeviceTypeEnum.IoT; | |
case "Windows.Team": | |
return DeviceTypeEnum.SurfaceHub; | |
case "Windows.Xbox": | |
return DeviceTypeEnum.Xbox; | |
default: | |
return DeviceTypeEnum.Other; | |
} | |
} | |
} | |
public enum DeviceTypeEnum | |
{ | |
Phone, | |
Tablet, | |
IoT, | |
Xbox, | |
SurfaceHub, | |
Other | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the original helper can be found here: https://gist.github.com/wagonli/40d8a31bd0d6f0dd7a5d