/// <summary>Notify listeners that the network is now reachable/unreachable.</summary>
        private void OnNetworkChange(Object sender, NetworkAvailabilityEventArgs args)
        {
            var evt = StatusChanged;
            if (evt == null)
            {
                return;
            }

            var status = args.IsAvailable
                ? NetworkReachabilityStatus.Reachable
                : NetworkReachabilityStatus.Unreachable;

            var eventArgs = new NetworkReachabilityChangeEventArgs(status);
            evt(this, eventArgs);
        }
        void InvokeNetworkChangeEvent(NetworkReachabilityStatus status)
        {
            if (_currentStatus == status)
            {
                return;
            }

            _currentStatus = status;
            var evt = _statusChanged;

            if (evt == null)
            {
                return;
            }

            var eventArgs = new NetworkReachabilityChangeEventArgs(status);

            evt(this, eventArgs);
        }
Ejemplo n.º 3
0
 private void NetworkStatusChanged(object sender, NetworkReachabilityChangeEventArgs e)
 {
     if (e.Status == NetworkReachabilityStatus.Reachable) {
         GoOnline();
     }
     else {
         GoOffline();
     }
 }
 void InvokeNetworkChangeEvent(NetworkReachabilityStatus status)
 {
     var evt = _statusChanged;
     if (evt == null)
     {
         return;
     }
     var eventArgs = new NetworkReachabilityChangeEventArgs(status);
     evt(this, eventArgs);
 }