示例#1
0
        /// <summary>
        /// Gets the current location.
        /// </summary>
        /// <returns>
        /// The current location represented as <see cref="ILocation"/>. If no location is available, <c>null</c> will be returned.
        /// </returns>
        public override ILocation GetCurrentLocation()
        {
            var currentCoordinate = _geoCoordinateWatcher.Position;
            var currentLocation = new Location(currentCoordinate.Location.Latitude, currentCoordinate.Location.Longitude, 
                currentCoordinate.Location.Altitude);

            return currentLocation;
        }
        /// <summary>
        /// Gets the current location.
        /// </summary>
        /// <returns>
        /// The current location represented as <see cref="ILocation"/>. If no location is available, <c>null</c> will be returned.
        /// </returns>
        public override ILocation GetCurrentLocation()
        {
            var location = _locationManager.GetLastKnownLocation(Provider);
            if (location == null)
            {
                return null;
            }

            var currentLocation = new Location(location.Latitude, location.Longitude, location.Altitude);
            return currentLocation;
        }