Win8 app判断网络连接状态

Win8 app判断网络连接状态

NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged; //网络连接发生变化时触发

        private bool IsConnectedToInternet()//有无网络连接判断
{
bool connected = false;
ConnectionProfile Conpro = NetworkInformation.GetInternetConnectionProfile();
if (Conpro != null)
{
NetworkConnectivityLevel network = Conpro.GetNetworkConnectivityLevel();
connected = network == NetworkConnectivityLevel.InternetAccess;
}
return connected;
}/* 何问起 hovertree.com */

推荐:http://www.cnblogs.com/roucheng/p/3535198.html

上一篇:CORS跨域 Ajax headers 问题


下一篇:android中判断网络连接是否可用