你的位置:首页 > 操作系统

[操作系统]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