public async Task ExecuteFetchMomentsCommand() { if (IsBusy) { return; } IsBusy = true; try { var connected = await CrossConnectivity.Current.IsRemoteReachable(Keys.ApplicationMobileService, 80, 10000); if (connected) { Moments.Clear(); var refreshedMoments = await MomentService.Instance.GetMoments(); Moments.AddRange(refreshedMoments); } else { DialogService.ShowError(Strings.NoInternetConnection); } } catch (Exception ex) { Xamarin.Insights.Report(ex); } IsBusy = false; }
public async Task ExecuteFetchMomentsCommand() { if (IsBusy) { return; } IsBusy = true; try { if (await ConnectivityService.IsConnected()) { Moments.Clear(); var refreshedMoments = await MomentService.GetMoments(); Moments.AddRange(refreshedMoments); } else { DialogService.ShowError(Strings.NoInternetConnection); } } catch (Exception ex) { Logger.Report(ex); } IsBusy = false; }
public async Task UpdateMomentsAsync() { if (IsBusy) { return; } IsBusy = true; try { if (await ConnectivityService.IsConnected()) { Moments.Clear(); //var items = await AzureService.Instance.GetItemsAsync(x => x.CountryCode == Country.CountryCode); var moments = await AmazonWebService.Instance.GetLatestMomentsAsync(); Moments.AddRange(moments); } else { DialogService.ShowError("No internet connection"); } } catch (Exception ex) { //Xamarin.Insights.Report(ex); } //UserDialogs.Instance.Toast(new ToastConfig(new ToastEvent(), "Test", "Testing toast functionality....fun!") //{ // Duration = TimeSpan.FromSeconds(3) //}); IsBusy = false; }