开发者

WP7 NetworkInterface.GetInternetInterfaceType()

开发者 https://www.devze.com 2023-03-25 06:35 出处:网络
I would like to determine programatically if the phone is connected to Wifi or not.I have found a number of references to the NetworkInterface.GetInternetInterfaceType() method (supposedly in Microsof

I would like to determine programatically if the phone is connected to Wifi or not. I have found a number of references to the NetworkInterface.GetInternetInterfaceType() method (supposedly in Microsoft.Devices.dll). I'm having trouble locating this method - using Windows Phone 7.0.开发者_如何学编程 Can someone point me in the right direction. I have located the GetIsNetworkAvailable method - however I want to actually determine the type of network connection.


The solution is to use Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType.

e.g. if (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)

Part of my original problem was that I was originally referencing the System.Net.NetworkInformation namespace instead of the Microsoft.Phone.Net.NetworkInformation namespace.

0

精彩评论

暂无评论...
验证码 换一张
取 消