문제

Dim _isNetworkAvailable = Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsWiFiEnabled

always returns false though I do have internet connection.
I'm testing on the emulator, could that be the source of the issue?

How I'm testing: I have a button that calls the above code and displays the result of the boolean in a textbox

도움이 되었습니까?

해결책

Your current code only check whether Wifi enabled or not on the device, which will always return false if you run in emulator. Because there is no interface to set Wifi enabled in WP7 emulator. You need to use IsNetworkAvailable property instead, to check if any internet connection available. See this MSDN link for reference. So your code should be as follow :

Dim _isNetworkAvailable = Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsNetworkAvailable
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top