windows-phone-8.1 C 如何检测在Windows 10 Mobile上启动的WP8.1应用程序?
发布时间:2023-12-19 16:07:47 所属栏目: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)具有这两个属性.这就是我们如何检测应用程序运行的操作系统的方法. (编辑:岳阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows 下 MongoDB 的安装与启动
- win10 spark+scala+eclipse+sbt 安装配置
- Windows-8 – 可以在Windows 10/Windows 8/WinRT中唯一标识
- windows – 在IIS下运行SVN存储库
- Windows下RabbitMQ安装,部署,配置
- .net – WiX:Windows启动时如何注册应用程序启动?
- 有没有办法在Windows cli中使用’COPY’命令(PostgreSQL)?
- windows – 如何为非Qt应用程序创建Qt共享库
- windows-7 C 无法完成操作,因为文件夹或其中的文件在另一个
- Windows Concole中的希腊字母
推荐文章
站长推荐
- Qt5对WinXP系统的支持和兼容情况
- windows-7 – Windows 7上的Visual Studio 2012仍
- _asm int 3 软件中断
- Windows环境下安装MySQL5.7及MySQL WrokBench
- .net – Windows Azure Web角色缓存(预览)“挂起
- 飞溅屏幕 – 通用窗口10个应用程序的Splash屏幕
- windows – 在matlab中监视内存
- Shared Event-loop for Same-Origin Windows(译)
- win10 安装msi 提示2502、2503的错误代码(已成功
- Windows系统下latex:texlive2018和texstudio