是否有更简单快速的方法来检测(Windows Phone 7)设备是否具有互联网连接 [英] Is there an easier fast way to detect whether the (Windows Phone 7) device has an internet connection
问题描述
是否有更简单快速的方法来检测(Windows Phone 7)设备是否具有互联网连接.
Is there an easier fast way to detect whether the (Windows Phone 7) device has an internet connection.
我目前正在发送网络请求,等待超时时间并处理异常.希望有一种快速简便的方法在发送任何请求之前查询设备以查看它是否有连接...
I'm currently sending a web request, waiting the timeout period and handling the exception. Hoping for a quick easy way to query the device to see whether it has a connection before sending any requests...
提前致谢,
推荐答案
如果没有连接,此方法将返回 NetworkInterfaceType.None.
This method will return NetworkInterfaceType.None if there is no connection.
NetworkInterface.GetInternetInterfaceType
或者,如果有连接,您将获得 NetworkInterfaceType.MobileBroadbandGSM、NetworkInterfaceType.Wireless80211 等.
Alternatively you will get NetworkInterfaceType.MobileBroadbandGSM, NetworkInterfaceType.Wireless80211, etc if there is a connection.
这篇关于是否有更简单快速的方法来检测(Windows Phone 7)设备是否具有互联网连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!