windows-phone-8.1 – 如何检测在Windows 10 Mobile上启动的WP8.1应用程序?
发布时间:2020-09-06 14:10:52 所属栏目:Windows 来源:互联网
导读:我需要在我的WP8.1应用程序代码中检查操作系统版本(WP 8.1或W10).有什么更好的方法呢?为此目的可能是反思或一些特殊的API? 我没有找到任何其他方法来做到这一点,所以这是我的方法. 以下属性IsWindows10检测Windows 10(包括Windows 10 Mobile)设备上是否运行
我需要在我的WP8.1应用程序代码中检查操作系统版本(WP 8.1或W10).有什么更好的方法呢?为此目的可能是反思或一些特殊的API? 我没有找到任何其他方法来做到这一点,所以这是我的方法. 以下属性IsWindows10检测Windows 10(包括Windows 10 Mobile)设备上是否运行Windows 8.1或Windows Phone 8.1应用程序. #region IsWindows10 static bool? _isWindows10; public static bool IsWindows10 => (_isWindows10 ?? (_isWindows10 = getIsWindows10Sync())).Value; static bool getIsWindows10Sync() { bool hasWindows81Property = typeof(Windows.ApplicationModel.Package).GetRuntimeProperty("DisplayName") != null; bool hasWindowsPhone81Property = typeof(Windows.Graphics.Display.DisplayInformation).GetRuntimeProperty("RawPixelsPerViewPixel") != null; bool isWindows10 = hasWindows81Property && hasWindowsPhone81Property; return isWindows10; } #endregion 它是如何工作的? 在Windows 8.1中,Package类具有DisplayName属性,Windows Phone 8.1没有该属性.在Windows Phone 8.1中,DisplayInformation类具有RawPixelsPerViewPixel属性,Windows 8.1没有该属性.Windows 10(包括Mobile)具有这两个属性.这就是我们如何检测应用程序运行的操作系统的方法. (编辑:百色站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 如何使用GUI独立于.NET或其他Libs为Windows制作便携式C程序
- haskell – 用于Windows的Linux主机上的GHC交叉编译源代码
- batch-file – 用于在Windows 7中更改屏幕分辨率的批处理文
- 在WPF中的所有Windows中应用按钮样式
- windows-phone-7 – Caliburn Micro中的墓碑
- 如何在Windows Phone 7系列上获取屏幕尺寸?
- 如何在Windows中挂钩应用程序和进程启动?
- winapi – Windows SDK 7.0的signtool中的signwizard发生了
- api – Windows Phone应用程序中的捐赠
- 02、Windows Server 2003域账户管理(02)
推荐文章
站长推荐
- winapi – 来自Win32应用程序的x64图像上的OpenP
- windows-phone-8 – 使用WNS for windows phone
- 标签为Windows的SSH工具?
- wpf – 使用WiX在应用程序的主要升级中从Windows
- row_number()在hql中的分区
- .net – Windows Azure上的AspPDF和AspJPEG
- windows – 启动进程时“print”和“printo”动词
- win10上部署Hadoop-2.7.3——非Cygwin、非虚拟机
- NodeJS、NPM安装配置步骤(windows版本) 以及环境
- php在windows环境下获得cpu内存实时使用率(推荐)
热点阅读