protected override async void OnAppearing() { if (!CrossConnectivity.Current.IsConnected) { //ErrorBtn.IsVisible = true; await DisplayAlert("Error", "Por favor activa tus datos o conectate a una red", "ok"); } if (!CrossGeolocator.IsSupported) { await DisplayAlert("Error", "Ha habido un error con el plugin", "ok"); } await GetDirecciones(); var pos = await CrossGeolocator.Current.GetPositionAsync(); Mapx.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(pos.Latitude, pos.Longitude), Distance.FromMiles(1))); var pin = new Pin { Type = PinType.Place, Position = new Position(pos.Latitude, pos.Longitude), Label = "Mi ubicacion", Address = " usted se encuentra aqui", }; Mapx.Pins.Add(pin); }
protected override async void OnAppearing() { if (!CrossConnectivity.Current.IsConnected) { ErrorBtn.IsVisible = true; ErrorLbl.Text = "No cuentas con conexion a internet, puedes trabajar de todas formas"; } if (!CrossGeolocator.IsSupported) { await DisplayAlert("Error", "Ha habido un error con el plugin", "ok"); } var pos = await CrossGeolocator.Current.GetPositionAsync(); Latit.Text = "Latitude: " + pos.Latitude.ToString(); Longit.Text = "Longitude:" + pos.Longitude.ToString(); Mapx.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(pos.Latitude, pos.Longitude), Distance.FromMiles(1))); var pin = new Pin { Type = PinType.Place, Position = new Position(pos.Latitude, pos.Longitude), Label = "Mi ubicacion", Address = "aqui se encuentra usted", }; Mapx.Pins.Add(pin); }
public VisitaInfo(int id) { InitializeComponent(); _ = GetVisitaInfo(id); Mapx.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(19.054598, -98.191248), Distance.FromMiles(1))); }
public void callMap(string lon, string lat, string cliente) { Mapx.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(Convert.ToDouble(lat), Convert.ToDouble(lon)), Distance.FromMiles(1))); var pin = new Pin { Type = PinType.Place, Position = new Position(Convert.ToDouble(lat), Convert.ToDouble(lon)), Label = "Ubicacion de cliente " + cliente, Address = "Direccion proporcionada", }; Mapx.Pins.Add(pin); }
public async Task CurrentLocation() { var pos = await CrossGeolocator.Current.GetPositionAsync(); Mapx.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(pos.Latitude, pos.Longitude), Distance.FromMiles(1))); var pin = new Pin { Type = PinType.Place, Position = new Position(pos.Latitude, pos.Longitude), Label = "Mi ubicacion", Address = " usted se encuentra aqui", }; Mapx.Pins.Add(pin); }
public async Task SetCurrentLocation() { Mapx.Pins.Clear(); Mapx.IsVisible = true; var pos = await CrossGeolocator.Current.GetPositionAsync(); Mapx.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(Double.Parse(latitud.Text), Double.Parse(longitude.Text)), Distance.FromMiles(1))); var pin = new Pin { Type = PinType.Place, Position = new Position(Double.Parse(latitud.Text), Double.Parse(longitude.Text)), Label = "Mi ubicacion", Address = " usted se encuentra aqui", }; Mapx.Pins.Add(pin); }
public async Task CurrentLocation() { Mapx.Pins.Clear(); Mapx.IsVisible = true; var pos = await CrossGeolocator.Current.GetPositionAsync(); Mapx.MoveToRegion( MapSpan.FromCenterAndRadius( new Position(pos.Latitude, pos.Longitude), Distance.FromMiles(1))); var pin = new Pin { Type = PinType.Place, Position = new Position(pos.Latitude, pos.Longitude), Label = desc.Text, Address = " solicitar lavado aqui", }; var x = 0000000; id_loc.Text = x.ToString(); longitude.Text = pos.Longitude.ToString(); desc.Text = "ubicacion actual sin id"; latitud.Text = pos.Latitude.ToString(); if (!CrossConnectivity.Current.IsConnected) { await DisplayAlert("Error de conexion", "Asegurece de estar conectado a una red wifi u otro acceso a internet", "ok"); await Navigation.PopToRootAsync(); } else { HttpClient client1 = new HttpClient(); var k = "AIzaSyBoKd3QoJ73KevoPbIgmixgU0Q5hvoK7PI"; var gv = await client1.GetAsync("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + pos.Latitude + "," + pos.Longitude + "&radius=5&type=formatted_address&keyword=street&key=" + k); if (gv.IsSuccessStatusCode) { var strjsn = await gv.Content.ReadAsStringAsync(); var jsond = JsonConvert.DeserializeObject <GooglePlaces>(strjsn); if (jsond.Status == "ZERO_RESULTS") { var gv2 = await client1.GetAsync("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + pos.Latitude + "," + pos.Longitude + "&radius=15&type=formatted_address&keyword=street&key=" + k); var str2 = await gv2.Content.ReadAsStringAsync(); var jsond2 = JsonConvert.DeserializeObject <GooglePlaces>(str2); if (jsond2.Status == "ZERO_RESULTS") { var gv3 = await client1.GetAsync("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + pos.Latitude + "," + pos.Longitude + "&radius=151&type=formatted_address&keyword=street&key=" + k); var str3 = await gv3.Content.ReadAsStringAsync(); var jsond3 = JsonConvert.DeserializeObject <GooglePlaces>(str3); if (jsond3.Status == "ZERO_RESULTS") { await DisplayAlert("Error de conexion", "El servidor esta teniendo problemas para encontrar su direccion, intente mas tarde", "ok"); // await Navigation.PopToRootAsync(); } else { var vi = jsond3.Results[0].Vicinity; directgp.Text = vi; } } else { var vi = jsond2.Results[0].Vicinity; directgp.Text = vi; } } else { var vi = jsond.Results[0].Vicinity; directgp.Text = vi; } } else { await DisplayAlert("Error de conexion", "El servidor esta teniendo problemas para encontrar su direccion, intente mas tarde", "ok"); await Navigation.PopToRootAsync(); } } Mapx.Pins.Add(pin); }