Esempio n. 1
0
        private async void OnConnectivityChanged(object sender, Plugin.Connectivity.Abstractions.ConnectivityChangedEventArgs e)
        {
            await SetConnectionAsync();

            System.Diagnostics.Debug.WriteLine($"Common In Connectivity Change Network Status : {_networkStatus} {_networkStatusService.NetworkStatus()}");
            if (_networkStatus != _networkStatusService.NetworkStatus())
            {
                _networkStatus = _networkStatusService.NetworkStatus();
                _messagingService.Send(new NetworkStatusChangedMessage());
            }
        }
Esempio n. 2
0
 public ConnectivityHelper(IMessagingService messagingService,
                           IThreadExecutionProvider threadExecutionProvider,
                           INetworkStatusService networkStatusService)
 {
     _messagingService        = messagingService;
     _threadExecutionProvider = threadExecutionProvider;
     _networkStatusService    = networkStatusService;
     _isConnected             = CrossConnectivity.Current.IsConnected;
     CrossConnectivity.Current.ConnectivityChanged += OnConnectivityChanged;
     _networkStatusService.NetworkStatusChanged    += NetworkStatusService_NetworkStatusChanged;
     _networkStatus = _networkStatusService.NetworkStatus();
 }
Esempio n. 3
0
 private void NetworkStatusBroadcastReceiver_ConnectionStatusChanged(object sender, EventArgs e)
 {
     _networkStatusService.NetworkStatus();
 }