问题
How can I check which platform (Windows / Windows Phone) my app is running?
回答1:
VersionInfo | versionInfo property should helps to check the platform information.
var str = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
if (str == "Windows.Desktop")
{
//...
}
else if (str == "Windows.Mobile")
{
//...
}
回答2:
Yes, you can use the compiler directives
#if WINDOWS_PHONE
//some code
#endif
#if WINDOWS
//some code
#endif
来源:https://stackoverflow.com/questions/32404755/check-platform-on-windows-10-universal-app