Esempio n. 1
0
        public void OnMapReady(GoogleMap googleMap)
        {
            mMap = googleMap;
			double lat = 13.7310;
			double lng = -89.1610;
			if (!this.geolocator.IsGeolocationAvailable || !this.geolocator.IsGeolocationEnabled) {
				alert.SetMessage ("Internet o GPS estan desactivados");
				alert.Show ();
				LatLng latlng = new LatLng (lat, lng);
				CameraUpdate marca_camera = CameraUpdateFactory.NewLatLngZoom (latlng, 12);
				mMap.MoveCamera (marca_camera);
			} else {
				this.geolocator.GetPositionAsync (timeout: 10000).ContinueWith (t => {
					lat = t.Result.Latitude;
					lng = t.Result.Longitude;
					LatLng latlng = new LatLng (lat, lng);
					CameraUpdate marca_camera = CameraUpdateFactory.NewLatLngZoom (latlng, 12);
					mMap.MoveCamera (marca_camera);
				}, TaskScheduler.FromCurrentSynchronizationContext ());
			}
            //MarkerOptions marca = new MarkerOptions()
            //    .SetPosition(latlng)
            //    .SetTitle("El Salvador")
            //    .SetSnippet("San Salvador")
            //    .Draggable(true);
            mMap.MarkerDragEnd +=mMap_MarkerDragEnd;
            //mMap.MarkerClick +=mMap_MarkerClick;
            mMap.MarkerDrag += mMap_MarkerDrag;
            mMap.SetInfoWindowAdapter(this);
            mMap.SetOnInfoWindowClickListener(this);
        }