我们如何在Windows Phone 8.1应用程序中检测Windows 10?

时间:2016-04-29 10:16:47

标签: c# windows-phone-8.1 win-universal-app windows-10-mobile

我的应用程序(在Windows Phone 8.1 RT环境中开发)使用OpenFilePicker,它允许我选择图像并捕获图像,但它工作得很好但是当我在Windows 10设备上部署此应用程序时,此功能只允许我选择一个来自图书馆的图片。我想到了一个解决方案,编写一个小代码块,可以帮助我检测像这样的操作系统版本

#if WINDOWS_PHONE_APP
//codes
#endif

但我不确切知道我需要做什么,所以请帮助我!

1 个答案:

答案 0 :(得分:1)

阅读此链接:

Windows Store Apps: Get OS Version, beginners tutorials (C#-XAML)

它的目的是一个简单的解决方案来检查操作系统是否具有反射的Windows 10功能:

var analyticsInfoType = Type.GetType("Windows.System.Profile.AnalyticsInfo, Windows, ContentType=WindowsRuntime"); 
var versionInfoType = Type.GetType("Windows.System.Profile.AnalyticsVersionInfo, Windows, ContentType=WindowsRuntime"); 

if (analyticsInfoType == null || versionInfoType == null) 
{ 
 // That's not Windows 10
}