0

ReverseGeocodeQuery でエラーが発生しています

1.in "GeoCoordinate(47.60887, -122.34094);" メソッドには戻り値の型が必要です

2.「reverseGeocode.GeoCoordinate行」では、reverseGeocodeはフィールドですが、タイプのように使用されます..

ReverseGeocodeQuery reverseGeocode = new ReverseGeocodeQuery();
reverseGeocode.GeoCoordinate = new GeoCoordinate(47.60887, -122.34094);
reverseGeocode.QueryCompleted += reverseGeocode_QueryCompleted;
reverseGeocode.QueryAsync();
void reverseGeocode_QueryCompleted(objectsender,QueryCompletedEventArgs<IList<MapLocation>> e)
{
MapAddress geoAddress = e.Result[0].Information.Address;           
}

私は名前空間を使用しました - Microsoft.Phone.Maps.Services; を使用します。

このエラーを修正する方法..

4

1 に答える 1

1

答えを得ました

GeoCoordinateWatcher myLocationWatcher;
private GeoCoordinate MyCoordinate = null;
private async void GetCurrentCoordinate()
    {
        Geolocator geolocator = new Geolocator();
        geolocator.DesiredAccuracy = PositionAccuracy.High;

        try
        {
            Geoposition currentPosition = await geolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(10));
            _accuracy = currentPosition.Coordinate.Accuracy;

            MyCoordinate = new GeoCoordinate(currentPosition.Coordinate.Latitude, currentPosition.Coordinate.Longitude);

            if (MyReverseGeocodeQuery == null || !MyReverseGeocodeQuery.IsBusy)
            {
                MyReverseGeocodeQuery = new ReverseGeocodeQuery();
                MyReverseGeocodeQuery.GeoCoordinate = new GeoCoordinate(MyCoordinate.Latitude, MyCoordinate.Longitude);
                LongitudeTextBlock.Text = MyCoordinate.Longitude.ToString();
                LatitudeTextBlock.Text = MyCoordinate.Latitude.ToString();
                MyReverseGeocodeQuery.QueryCompleted += ReverseGeocodeQuery_QueryCompleted;
                MyReverseGeocodeQuery.QueryAsync();
            }

        }
        catch (Exception ex)
        {
            // ...

        }

    }


    public void ReverseGeocodeQuery_QueryCompleted(object sender, QueryCompletedEventArgs<IList<MapLocation>> e)
    {
        if (e.Error == null)
        {
            if (e.Result.Count > 0)
            {
                MapAddress address = e.Result[0].Information.Address;
                labelResults.Text = "Current Location: " + address.City + ", " + address.State;
            }
        }
    }


    public void Button_Click(object sender, RoutedEventArgs e)
    {
        GetCurrentCoordinate();

    }
于 2013-08-19T15:47:38.460 に答える