private async void LoadBibles() { this.IsRefreshing = true; var connection = await this.apiservices.CheckConnection(); if (!connection.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( Languages.Error, connection.Message, Languages.Accept); await App.Navigator.PopAsync(); return; } var apiBible = Application.Current.Resources["APIBible"].ToString(); var response = await this.apiservices.Get <BibleResponse> ( apiBible, "/api", "/bibles" ); if (!response.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( Languages.Error, response.Message, Languages.Accept); await App.Navigator.PopAsync(); return; } this.bibleResponse = (BibleResponse)response.Result; this.Bibles = new ObservableCollection <BibleItemViewModel>( this.ToBibleItemViewModel()); this.IsRefreshing = false; }
private async void LoadBibles() { this.IsRefreshing = true; var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( "Error", connection.Message, "Accept"); await Application.Current.MainPage.Navigation.PopAsync(); return; } var response = await this.apiService.Get <BibleResponse>( "http://api.biblesupersearch.com", "/api", "/bibles"); if (!response.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( "Error", response.Message, "Accept"); await Application.Current.MainPage.Navigation.PopAsync(); return; } this.bibleResponse = (BibleResponse)response.Result; this.Bibles = new ObservableCollection <BibleItemViewModel>( this.ToBibleItemViewModel()); this.IsRefreshing = false; }
private async void LoadBibles() { this.IsRefreshing = true; var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( Languages.Error, connection.Message, Languages.Accept); return; } var response = await this.apiService.Get <BibleResponse>( "http://api.biblesupersearch.com", "/api", "/bibles"); if (!response.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( Languages.Error, response.Message, Languages.Accept); return; } this.bibleResponse = (BibleResponse)response.Result; this.Bibles = new ObservableCollection <BibleItemViewModel>( this.ToBibleItemViewModel()); MainViewModel.GetInstance().BiblesList = this.bibleResponse.Bibles.Select(b => b.Value.Name).ToList(); this.IsRefreshing = false; }
//para traer las biblias private async void LoadBibles() { this.IsRefreshing = true; var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( "Error", connection.Message, "Accept"); return; } //método asíncrono var response = await this.apiService.Get <BibleResponse>( "http://api.biblesupersearch.com", //línea base "/api", //prefijo "/bibles"); //nombre controlador if (!response.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert( "Error", response.Message, "Accept"); return; } this.bibleResponse = (BibleResponse)response.Result; this.Bibles = new ObservableCollection <BibleItemViewModel>( this.ToBibleItemViewModel()); this.IsRefreshing = false; }