WP7如何在设备调试飞行模式?模式、设备、如何在

2023-09-03 04:43:18 作者:我们之间﹌隔着一片海

有没有办法在设备上调试飞行模式?我试着开启飞行模式,在设备设置和禁用我的电脑上的互联网连接,但NetworkInterface.GetIsNetworkAvailable()仍返回true。难道我做错了什么?

Is there a way to debug airplane mode on the device? I tried turning airplane mode on in the device settings and disabling the internet connection on my computer, but NetworkInterface.GetIsNetworkAvailable() still returns true. Am I doing something wrong?

推荐答案

注意上的官方文档:

这个API将始终返回true上   在Windows Phone 7模拟器。测试   因此需要一个门面,模拟或   的code条件块。

This API will always return true on the Windows Phone 7 emulator. Testing therefore requires a facade, mock or conditional chunk of code.

我刚刚测试这在实际设备上,事实上,它返回一个恒定的

I just tested this on an actual device and indeed, it returns a constant true.

然而,事情是 - 这一切都是因为你把你的手机连接到PC和以太网接口可用。一旦断开手机与启动应用程序,你会看到一个假将被退回。

However, the thing is - it is all because you keep your phone connected to the PC and the Ethernet interface is available. Once you disconnect the phone and start the app, you will see that a False will be returned.