确定 Metro 应用程序正在 Windows 8 选项卡或台式电脑中运行选项卡、应用程序、台式电脑、Metro

由网友(歌散酒初醒)分享简介:我正在开发具有 Windows 8 Metro 风格的应用程序.与平板电脑相比,如果它在台式电脑上运行,此应用程序具有更多功能.但我的问题是如何检测应用程序是否在 PC 或 Tab 中运行.我不想为 PC 和 TAB 分别发布 2 版本.I am developing app with windows 8 metro...

我正在开发具有 Windows 8 Metro 风格的应用程序.与平板电脑相比,如果它在台式电脑上运行,此应用程序具有更多功能.但我的问题是如何检测应用程序是否在 PC 或 Tab 中运行.我不想为 PC 和 TAB 分别发布 2 版本.

I am developing app with windows 8 metro style. This app has some more feature if it running in desktop pc compared to Tablet. But my problem is how to detect app is running in PC or Tab. I don't want to release 2 build seperately for PC and TAB.

请帮助我.更新:GetSystemMatrics 是否可以做到这一点?在桌面上,我们的应用程序的行为类似于客户端和服务器,但在选项卡和移动设备中,它的行为仅类似于客户端

Please help me. Update: Wheter is it possible to do it with GetSystemMatrics? In the desktop, our app behave like client and server, but in the tab and mobile device it behave like client only

推荐答案

Windows.Devices 命名空间包含大量有关设备功能的信息.例如,要确定设备是否启用触摸,您可以使用:

Windows.Devices namespace has a wealth of information about device capabilities. For example to determine if the device is touch enabled, you can use:

var hasTouch = Windows.Devices.Input
                  .PointerDevice.GetPointerDevices()
                  .Any(p => p.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Touch);
阅读全文

相关推荐

最新文章