windows-phone-8.1 C 如何检测在Windows 10 Mobile上启动的WP8.1应用程序?
发布时间:2023-12-19 02:59:08 所属栏目:Windows 来源:DaWei
导读: 我需要在我的WP8.1应用程序代码中检查操作系统版本(WP 8.1或W10).有什么更好的方法呢?为此目的可能是反思或一些特殊的API?
我没有找到任何其他方法来做到这一点,所以这是我的方法.
我没有找到任何其他方法来做到这一点,所以这是我的方法.
我需要在我的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)具有这两个属性.这就是我们如何检测应用程序运行的操作系统的方法. (编辑:台州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 32位数据转8位数据和8位数据转32位数据
- row_number()在hql中的分区
- windows-8 – 如何向可以定位多个平台的商店提交应用程序?
- Windows系统·添加Python import 的库/模块路径
- 在Windows上使用clang编译c 11程序时出错
- windows-phone-8 – 适用于Windows Phone 8的企业应用程序分
- adodb – Windows脚本宿主(jscript):我如何下载二进制文件
- windows – 为什么模拟会话中定义的DOS设备不会出现在资源管
- edge浏览器js错误问题该怎么修复呢
- 如何正确创建一个nim / nimrod windows dll
推荐文章
站长推荐
- windows – 如何成功更改执行策略并启用PowerShe
- windows环境redmine安装及应用
- windows-mobile – Visual Studio 2010 Professi
- 值为NULL的列是否会影响Microsoft SQL Server的性
- Windows 10 下彻底关闭 Hyper-V 服务
- windows-installer – installshield和windowsin
- win7运行mapreduce报错Could not locate executa
- WiX – 通过检查修订来防止降级
- 02、Windows Server 2003域账户管理(02)
- svchost.exe过程是什么 一直下载如何处理好