コード例 #1
0
 private void InvokeCoordsChanged(CoordsChangeData coordsChangeData)
 {
     if (CoordsChanged is not null)
     {
         CoordsChanged.Invoke(coordsChangeData);
     }
 }
コード例 #2
0
        public async Task <Position> GetCurrentLocation()
        {
            location = new LocationService();
            location.PositionChanged += (s, e) =>
            {
                CoordsChanged?.Invoke(s, e);
            };

            var position = await location.GetCurrentPosition();

            return(position);
        }
        // Instance method to get the current GPS location Coordinates from device
        public async Task <Position> GetCurrentLocation()
        {
            // Initialise our location service variable that points to our LocationService class
            location = new LocationService();
            location.LocationChanged += (sender, e) =>
            {
                // Raise our PositionChanged EventHandler, using the Coordinates
                CoordsChanged.Invoke(sender, e);
            };

            // Get the current device GPS location coordinates
            var position = await location.GetCurrentPosition();

            return(position);
        }