private async void LoadDiarioGeneral() { this.IsRefreshing = true; //========================Validacion de la conexion al internet y el servidor=============================================================== var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { this.IsRefreshing = false; // "No se pudo conectar el servidor") if (connection.Result.ToString() == "No se pudo conectar el servidor") { await Application.Current.MainPage.DisplayAlert(Languages.Error, Languages.NoServer, Languages.Accept); System.Diagnostics.Process.GetCurrentProcess().CloseMainWindow(); } else { Device.BeginInvokeOnMainThread(async() => { await Application.Current.MainPage.DisplayAlert(Languages.Error, Languages.TurnOnInternet, Languages.Accept); }); CerrarPrograma(); return; } } //========================fin de la conexion al internet y el servidor====================================================================== var url = Application.Current.Resources["UrlAPI"].ToString(); var prefix = Application.Current.Resources["UrlPrefix"].ToString(); var controller = Application.Current.Resources["UrlDiarioController"].ToString(); //string id = $"{"/"}{App.IdActual}"; var response = await this.apiService.GetList <DiarioGeneral>(url, prefix, controller); if (!response.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert(Languages.Error, Languages.NoServer, Languages.Accept); return; } //this.MyClientes = (List<Clientes>)response.Result; //this.IsRefreshing = false; MainViewModel.GetInstance().DiarioGeneralList = (List <DiarioGeneral>)response.Result; this.DiarioGeneral = new ObservableCollection <DiarioGeneralItemViewModel>(this.ToDiarioItemViewModel()); this.DebitoSum = (decimal)DiarioGeneral.Sum(p => p.Debito); this.CreditoSum = (decimal)DiarioGeneral.Sum(p => p.Credito); CultureInfo cultureInfo = new CultureInfo("es-DO"); this.Balance = string.Format(cultureInfo, "{0:C0}", this.CreditoSum - this.DebitoSum); this.IsRefreshing = false; }