Ejemplo n.º 1
0
        private void Connectivity_ConnectivityChanged(object sender, Xamarin.Essentials.ConnectivityChangedEventArgs e)
        {
            if ((e.ConnectionProfiles.Contains(Xamarin.Essentials.ConnectionProfile.WiFi) || e.ConnectionProfiles.Contains(Xamarin.Essentials.ConnectionProfile.Cellular)) && e.NetworkAccess == Xamarin.Essentials.NetworkAccess.Internet)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    app.UpdateDeviceInfo();
                });

                Device.BeginInvokeOnMainThread(() =>
                {
                    var request = new ChangeLanguagesModel();
                    if (Application.Current.Properties.ContainsKey("AppLocale") && (Application.Current.Properties["AppLocale"].ToString()).Contains("en"))
                    {
                        request.language = "en";
                        request.user_id  = BaseViewModel.user_id;
                    }
                    else
                    {
                        request.language = "ar";
                        request.user_id  = BaseViewModel.user_id;
                    }

                    app.UpdateLanguageServer(request);
                });

                Device.BeginInvokeOnMainThread(() =>
                {
                    app.GetCountriesApi();
                });
            }
        }
 private void OnConnectivityChanged(object sender, Xamarin.Essentials.ConnectivityChangedEventArgs e)
 {
     // Should only refresh when loader is in NoNetwork AND network is now active
     if (_dataLoader.State.Error is NoNetworkException &&
         e.NetworkAccess == Xamarin.Essentials.NetworkAccess.Internet)
     {
         RaiseLoadRequested();
     }
 }
 private void Connectivity_ConnectivityChanged(object sender, Xamarin.Essentials.ConnectivityChangedEventArgs e)
 {
     if (e.NetworkAccess == Xamarin.Essentials.NetworkAccess.Internet)
     {
         SnackbarExtension.Display_Online_SnackMessage(coordinatorLayout, this);
     }
     else
     {
         SnackbarExtension.Display_Offline_SnackMessage(coordinatorLayout, this);
     }
 }
Ejemplo n.º 4
0
        async void HandleConnectivityChanged(object sender, Xamarin.Essentials.ConnectivityChangedEventArgs e)
        {
            if (e.NetworkAccess is Xamarin.Essentials.NetworkAccess.Internet)
            {
                var apiResponse = await _apiService.GetHttpResponseMessage().ConfigureAwait(false);

                if (apiResponse.IsSuccessStatusCode)
                {
                    await _databaseSyncService.SyncRemoteAndLocalDatabases().ConfigureAwait(false);
                }
            }
        }
Ejemplo n.º 5
0
        private async void Connectivity_ConnectivityChanged(object sender, Xamarin.Essentials.ConnectivityChangedEventArgs e)
        {
            if (e.NetworkAccess == Xamarin.Essentials.NetworkAccess.Internet)
            {
                await SignalR.GetHubConnection();

                await SalvarSalaWifi();

                salasFragment.Refresh();
                Android.Support.V4.App.FragmentTransaction ft = SupportFragmentManager.BeginTransaction();
                ft.Detach(salasFragment);
                ft.Attach(salasFragment);
                ft.Commit();
            }
        }
 private void OnConnectivityChanged(object sender, Xamarin.Essentials.ConnectivityChangedEventArgs e)
 {
     HasNetworkAccess = HasInternetNetworkAccess(e.NetworkAccess);
 }