void GetDondeComprar() { ResetUI(); if (!NetworkInterface.GetIsNetworkAvailable()) { ConnectionError.Visibility = Visibility.Visible; Dispatcher.BeginInvoke(() => MessageBox.Show("Ha habido un error intentando acceder a los nuevos datos o no hay conexiones de red disponibles.\nPor favor asegúrese de contar con acceso de red y vuelva a intentarlo.")); return; } GeoPosition <GeoCoordinate> currentLocation = PositionService.GetCurrentLocation(); if (!App.Configuration.IsLocationEnabled) { Dispatcher.BeginInvoke(() => MessageBox.Show("Para buscar, por favor, active la función de localización en la configuración de la aplicación.")); return; } if (currentLocation == null) { Dispatcher.BeginInvoke(() => MessageBox.Show("Para buscar, por favor, active la función de localización.")); return; } ProgressBar.Show("Buscando más cercanos..."); if (App.Configuration.IsLocationEnabled && PositionService.GetCurrentLocation().Location != null) { var pushpin = new MapOverlay { GeoCoordinate = PositionService.GetCurrentLocation().Location, ContentTemplate = Application.Current.Resources["locationPushpinTemplate"] as DataTemplate, }; _pointsLayer.Add(pushpin); Mapa.SetView(Mapa.CreateBoundingRectangle()); } if (ViewModel.Puntos.Count == 0) { Refreshing.Visibility = Visibility.Visible; } SetApplicationBarEnabled(false); CancelarRequest(); var param = new Dictionary <string, object> { { "cant", 10 }, }; var client = new HttpClient(); _httpReq = client.Get(string.Format("/api/{0}sube", ViewModel.Tipo).ToApiCallUri(param)); _httpReq.BeginGetResponse(HTTPWebRequestCallBack, _httpReq); }
public void Cargar(bool refresh = false) { if (NetworkInterface.GetIsNetworkAvailable()) { ProgressBar.Show("Actualizando estado..."); var client = new HttpClient(); _httpReq = client.Get("/api/bicicleta".ToApiCallUri(refresh)); _httpReq.BeginGetResponse(HTTPWebRequestCallBack, _httpReq); } else { ShowErrorConnection(); } }
void GetColectivosCercanos() { ResetUI(); if (!NetworkInterface.GetIsNetworkAvailable()) { ConnectionError.Visibility = Visibility.Visible; Dispatcher.BeginInvoke(() => MessageBox.Show("Ha habido un error intentando acceder a los nuevos datos o no hay conexiones de red disponibles.\nPor favor asegúrese de contar con acceso de red y vuelva a intentarlo.")); return; } GeoPosition <GeoCoordinate> currentLocation = PositionService.GetCurrentLocation(); if (!App.Configuration.IsLocationEnabled) { Dispatcher.BeginInvoke(() => MessageBox.Show("Para buscar colectivos cercanos, por favor, active la función de localización en la configuración de la aplicación.")); return; } if (currentLocation == null) { Dispatcher.BeginInvoke(() => MessageBox.Show("Para buscar colectivos cercanos, por favor, active la función de localización.")); return; } ProgressBar.Show("Buscando más cercanos..."); if (ViewModel.Items.Count == 0) { Refreshing.Visibility = Visibility.Visible; } SetApplicationBarEnabled(false); CancelarRequest(); var client = new HttpClient(); _httpReq = client.Get("/transporte/cercano".ToApiCallUri()); _httpReq.BeginGetResponse(HTTPWebRequestCallBack, _httpReq); }