private void CheckConnectionStatus()
        {
            var remoteHostStatus = Reachability.RemoteHostStatus();
            var internetStatus   = Reachability.InternetConnectionStatus();
            var localWifiStatus  = Reachability.LocalWifiConnectionStatus();

            IsConnected = (internetStatus != NetworkStatus.NotReachable) || (localWifiStatus != NetworkStatus.NotReachable) ||
                          (remoteHostStatus != NetworkStatus.NotReachable);
        }
Пример #2
0
 public Connectivity()
 {
     Reachability.ReachabilityChanged += (sender, args) =>
     {
         var remoteHostStatus = Reachability.RemoteHostStatus();
         var internetStatus   = Reachability.InternetConnectionStatus();
         var localWifiStatus  = Reachability.LocalWifiConnectionStatus();
         IsConnected = (internetStatus == NetworkStatus.ReachableViaCarrierDataNetwork ||
                        internetStatus == NetworkStatus.ReachableViaWiFiNetwork) ||
                       (localWifiStatus == NetworkStatus.ReachableViaCarrierDataNetwork ||
                        localWifiStatus == NetworkStatus.ReachableViaWiFiNetwork) ||
                       (remoteHostStatus == NetworkStatus.ReachableViaCarrierDataNetwork ||
                        remoteHostStatus == NetworkStatus.ReachableViaWiFiNetwork);
     };
 }
Пример #3
0
        private void CheckConnectionStatus(bool fireMissiles = true)
        {
            var internetStatus = Reachability.InternetConnectionStatus();

            switch (internetStatus)
            {
            case NetworkStatus.NotReachable:
                ChangeConnectivityStatus(false, false, false, fireMissiles);
                break;

            case NetworkStatus.ReachableViaCarrierDataNetwork:
                ChangeConnectivityStatus(true, false, true, fireMissiles);
                break;

            case NetworkStatus.ReachableViaWiFiNetwork:
                ChangeConnectivityStatus(true, true, false, fireMissiles);
                break;
            }
        }