Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Create class ConnectionInternet and add " Using Windows.Networking.Connectivity.
public class ConnectToInternet
{
public bool _ConnectInternet()
{
ConnectionProfile internetprofile = NetworkInformation.GetInternetConnectionProfile();
if (internetprofile == null)
{
return false;
}
var level = internetprofile.GetNetworkConnectivityLevel();
return level == NetworkConnectivityLevel.InternetAccess;
}
}
We finished the part class. Now, we will come back to xaml.cs
MainPage class or NavigationHelper_LoadState. We will check the internet here.
if (ConnectToInternet._ConnectToInternet())
{
/*Here code*/
}
else
Messages._ShowMessages("Verify you internet connection!!!");
Messages._ShowMessages is one class to show error.