Windows phone 获取网络连接情况

public static string GetNetStates()
        {
            var info = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType;
            switch (info)
            {
                case NetworkInterfaceType.MobileBroadbandCdma:
                    return "CDMA";
                case NetworkInterfaceType.MobileBroadbandGsm:
                    return "CSM";
                case NetworkInterfaceType.Wireless80211:
                    return "WiFi";
                case NetworkInterfaceType.Ethernet:
                    return "Ethernet";
                case NetworkInterfaceType.None:
                    return "None";
                default:
                    return "Other";
            }
        }

 

posted @ 2012-07-25 14:12  lanmiao  阅读(163)  评论(1编辑  收藏  举报