如何在 Windows 8 中以编程方式检查/切换飞行模式? [英] How to check/switch the airplane mode programmatically in Windows 8?

查看:35
本文介绍了如何在 Windows 8 中以编程方式检查/切换飞行模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须检查是否在 Windows 8 中启用了飞行模式,并可能切换其状态.我目前正在开发 C# .NET 4.0 Windows 窗体应用程序,但此问题中的答案不应受此限制.

I have to check if the Airplane Mode is enabled in Windows 8 and maybe switch its state. I am currently working on a C# .NET 4.0 Windows Forms application but the answers in this question shouldn't be limited by that.

推荐答案

遗憾的是,Metro 应用程序无法在 Windows 8 中以编程方式更改飞行模式.应用程序外出违反 Metro 指南它的沙箱并在未经用户许可的情况下修改系统设置(请参阅 http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/1ad10725-b1b8-4723-b2c3-861900809e02).

Unfortunately, there isn't a programmatic way for Metro apps to change the airplane mode in Windows 8. It is against the Metro guidelines for an application to go outside its sandbox and modify system settings like this without user permission (see the discussion at http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/1ad10725-b1b8-4723-b2c3-861900809e02).

现在,您可以使用 Windows.Networking.NetworkOperators 命名空间.具体来说,请查看 MobileBroadbandRadioStateNetworkDeviceStatus 枚举.

Now, you may be able to figure out the status by using some of the functionality in the Windows.Networking.NetworkOperators namespace. Specifically, check out the MobileBroadbandRadioState and NetworkDeviceStatus enumerations.

或者,您可以通过解释如何使用 Windows 键 + I、更改 PC 设置、无线、飞行模式访问设置来提示用户进行更改.

Or, you could prompt the user to make the change by explaining how to access the setting using Windows Key + I, Change PC Settings, Wireless, Airplane Mode.

这篇关于如何在 Windows 8 中以编程方式检查/切换飞行模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆