コード例 #1
0
		void UpdateAddress (LocationData location)
		{
			if(location != null)
			{
				Address = string.Format("{0}, {1}", location.UserCountry, location.UserCity);
			}
		}
コード例 #2
0
		async void GetLastKnownUpdate ()
		{
			var location = _locationManager.GetLastKnownLocation (LocationManager.NetworkProvider);

			_lastKnownLocation = await ReverseGeocodeCurrentLocation(location);

			OnUserLocationChangedEvent(new UserLocationChangedEventArgs(()=>_lastKnownLocation));
		}
コード例 #3
0
		async Task<LocationData> ReverseGeocodeCurrentLocation(Location location)
		{
			return await Task.Run<LocationData>(async()=>{

				var geocoder = new Geocoder(EmpleadoApp.AppContext);

				var addressList =
					await geocoder.GetFromLocationAsync(location.Latitude, location.Longitude, 10);

				var address = addressList.FirstOrDefault();

				var locationData = new LocationData
				{
					UserCity = address.Locality,
					UserCountry = address.AdminArea,
					UserStreet = address.Thoroughfare,
					PostalCode = address.PostalCode
				};

				return locationData;

			});
		}
コード例 #4
0
		public async void OnLocationChanged (Location location)
		{
			_lastKnownLocation = await ReverseGeocodeCurrentLocation(location);

			OnUserLocationChangedEvent(new UserLocationChangedEventArgs(()=>_lastKnownLocation));
		}
コード例 #5
0
		public UserLocationChangedEventArgs (Func<LocationData> action)
		{
			GetLastKnownUserLocation = action.Invoke();
		}
コード例 #6
0
 public UserLocationChangedEventArgs(Func <LocationData> action)
 {
     GetLastKnownUserLocation = action.Invoke();
 }
コード例 #7
0
        public async void OnLocationChanged(Location location)
        {
            _lastKnownLocation = await ReverseGeocodeCurrentLocation(location);

            OnUserLocationChangedEvent(new UserLocationChangedEventArgs(() => _lastKnownLocation));
        }