WP7 NetworkInterface.GetInternetInterfaceType()
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.
精彩评论