0

I am developing a UWP C# app which includes a map control part. I modified and used the following code taken from https://msdn.microsoft.com/en-us/library/windows/apps/mt219697.aspx

using Windows.Services.Maps;
using Windows.Devices.Geolocation;
...

private async void reverseGeocode(Geopoint revLoc)
{            
    MapLocationFinderResult result = await MapLocationFinder.FindLocationsAtAsync(revLoc);

    if (result.Status == MapLocationFinderStatus.Success)
    {
        txtName.Text = result.Locations[0].Address.Street + ", " + result.Locations[0].Address.Town;
    }
}

Then I get the following error

'IAsyncOperation' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IAsyncOperation' could be found (are you missing a using directive for 'System'?)

Then I removed the "async" and "await"

private void reverseGeocode(Geopoint revLoc)
{            
    MapLocationFinderResult result = MapLocationFinder.FindLocationsAtAsync(revLoc);

    if (result.Status == MapLocationFinderStatus.Success)
    {
        txtName.Text = result.Locations[0].Address.Street + ", " + result.Locations[0].Address.Town;
    }
}

Then I get the following error

Cannot implicitly convert type 'Windows.Foundation.IAsyncOperation' to 'Windows.Services.Maps.MapLocationFinderResult'

Please help, Thank You

Red
  • 2,728
  • 1
  • 20
  • 22
Janak
  • 460
  • 5
  • 15

0 Answers0