有没有办法在设备上调试飞行模式?我试着开启飞行模式,在设备设置和禁用我的电脑上的互联网连接,但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.