1 public static bool IsWifiConnected() 2 { 3 bool isWifiConnected = false; 4 ConnectionProfile currentConnectionForInternet = NetworkInformation.GetInternetConnectionProfile(); 5 if(currentConnectionForInternet == null) 6 { 7 return false; 8 } 9 if(currentConnectionForInternet.IsWlanConnectionProfile) 10 { 11 if(currentConnectionForInternet.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess) 12 { 13 return true; 14 } 15 } 16 return false; 17 }
Windows 8.1 和 Windows Phone 8.1 Runtime 检测 WiFi 是否可用使用以上方法。(感觉比WP8 silverlight 麻烦-_-)
时间: 2024-10-12 12:08:49