private void CheckConnectionStatus(bool fireMissiles = true)
{
var profiles = NetworkInformation.GetConnectionProfiles();
var internet = false;
var wifi = false;
var mobile = false;
foreach (var profile in profiles) {
var connectivityLevel = profile.GetNetworkConnectivityLevel();
if (connectivityLevel == NetworkConnectivityLevel.InternetAccess || connectivityLevel == NetworkConnectivityLevel.ConstrainedInternetAccess)
internet = true;
if (profile.IsWlanConnectionProfile)
wifi = true;
if (profile.IsWwanConnectionProfile)
mobile = true;
}
ConnectionProfile internetConnectionProfile;
if ((internetConnectionProfile = NetworkInformation.GetInternetConnectionProfile()) != null) {
if (internetConnectionProfile.GetNetworkConnectivityLevel() ==
NetworkConnectivityLevel.InternetAccess)
internet = true;
if (internetConnectionProfile.IsWlanConnectionProfile)
wifi = true;
if (internetConnectionProfile.IsWwanConnectionProfile)
mobile = true;
}
ChangeConnectivityStatus(internet, wifi, mobile, fireMissiles);
}