获得当前的网络连接状态

#region 获得当前的网络连接状态
public static bool CheckNetwork()
{
bool isOnline = false;
//获得当前的网络连接状态
ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();
if (InternetConnectionProfile == null)
{
//断网情况下
}
else
{
isOnline = true;
}
return isOnline;
} 
#endregion
原文地址:https://www.cnblogs.com/lyl6796910/p/4672705.html