public void Init()
		{
			if (!locationWatcher.Started)
			{
				locationWatcher.Start(
					new MvxLocationOptions{Accuracy = MvxLocationAccuracy.Coarse},
					loc =>
					{
						UserLocation = loc;
						const double tolerance = 0.001;
						if (Math.Abs(loc.Coordinates.Latitude) > tolerance && 
							Math.Abs(loc.Coordinates.Longitude) > tolerance)
							locationWatcher.Stop();
					}, 
					error => { });
			}

			// defaults
			userAge = 0;
			userId = string.Empty;
			userGender = Gender.Unknown;
			userLocation = new MvxGeoLocation
			{
				Coordinates = new MvxCoordinates
				{
					Latitude = 0,
					Longitude = 0,
					Accuracy = 0
				}
			};
		}
 private void OnSuccess(MvxGeoLocation obj)
 {
     _parent.RunOnUiThread(() => {
                                     Lat = obj.Coordinates.Latitude;
                                     Lng = obj.Coordinates.Longitude;
                     });
 }
Пример #3
0
 protected virtual void SendLocation(MvxGeoLocation location)
 {
     LastSeenLocation = location;
     var callback = _locationCallback;
     if (callback != null)
         callback(location);
 }
        private void OnSuccess(MvxGeoLocation location)
        {
            var message = new LocationMessage(this, 
                                location.Coordinates.Latitude, 
                                location.Coordinates.Longitude);

            _messenger.Publish(message);
        }
 private void OnNewLocation(MvxGeoLocation location)
 {
     if (location != null && location.Coordinates != null)
     {
         Lat = location.Coordinates.Latitude;
         Lng = location.Coordinates.Longitude;
     }
 }
        protected virtual void SendLocation(MvxGeoLocation location)
        {
            var callback = _locationCallback;

            if (callback != null)
            {
                callback(location);
            }
        }
        private void OnLocationFound(MvxGeoLocation location)
        {
            try
            {
                Lat = location.Coordinates.Latitude.ToString();
                Lon = location.Coordinates.Longitude.ToString();
            }
            catch (Exception ex)
            {

            }
        }
        private void OnSuccess(MvxGeoLocation location)
        {
            lock (_lockObject)
            {
                _latestLocation = location;
            }

            var message = new LocationMessage(this, 
                                location.Coordinates.Latitude, 
                                location.Coordinates.Longitude);

            _messenger.Publish(message);
        }
 private void OnLocation(MvxGeoLocation location)
 {
     Location = location;
 }
Пример #10
0
 private void OnLocation(MvxGeoLocation obj)
 {
 }
Пример #11
0
		void OnLocation(MvxGeoLocation location)
		{
			this.LastKnownLocation = location;
		}
Пример #12
0
		public LocationUpdatedMessege(object sender, MvxGeoLocation location = null)
			: base(sender)
		{
			Location = location;
		}
Пример #13
0
        private void UpdateLocation(MvxGeoLocation location)
        {
            var lat = "Unknown";
            var lng = "Unknown";

            if (location != null
                && location.Coordinates != null)
            {
                lat = location.Coordinates.Latitude.ToString();
                lng = location.Coordinates.Longitude.ToString();
            }

            _latText.Text = lat;
            _lngText.Text = lng;
        }
Пример #14
0
 private void OnLocation(MvxGeoLocation location)
 {
     RunOnUiThread(() => UpdateLocation(location));
 }
Пример #15
0
 private void OnLocation(MvxGeoLocation location)
 {
     Lat = location.Coordinates.Latitude;
     Lng = location.Coordinates.Longitude;
     HasGpsLocation = true;
 }
Пример #16
0
 private void OnLocation(MvxGeoLocation location)
 {
     StatusMessage = "Current location is:";
     Latitude = location.Coordinates.Latitude.ToString();
     Longitude = location.Coordinates.Longitude.ToString();
 }
        public MvxGeoLocation ComputeCurrentPosition()
        {
            _lastUpdate = DateTime.UtcNow;
            _currentLocationIndex = _currentLocationIndex + 1;

            var location = _sensorData.Locations[_currentLocationIndex];
            _currentLocation = ConvertToMvxGeoLocation(location);
            return _currentLocation;
        }
        private static MvxGeoLocation CreateLocation(Location androidLocation)
        {
            var position = new MvxGeoLocation {Timestamp = androidLocation.Time.FromMillisecondsUnixTimeToUtc()};
            var coords = position.Coordinates;

            if (androidLocation.HasAltitude)
                coords.Altitude = androidLocation.Altitude;

            if (androidLocation.HasBearing)
                coords.Heading = androidLocation.Bearing;

            coords.Latitude = androidLocation.Latitude;
            coords.Longitude = androidLocation.Longitude;
            if (androidLocation.HasSpeed)
                coords.Speed = androidLocation.Speed;
            if (androidLocation.HasAccuracy)
            {
                coords.Accuracy = androidLocation.Accuracy;
            }

            return position;
        }