Windows phone 8 ReverseGeocodeQuery给定错误

Windows phone 8 ReverseGeocodeQuery给定错误,windows-phone-8,maps,geocoding,bing-maps,reverse-geocoding,Windows Phone 8,Maps,Geocoding,Bing Maps,Reverse Geocoding,ReverseGeocodeQuery出现错误 1.在“GeoCoordination(47.60887,-122.34094);”中,方法必须具有返回类型 2.在“reverseGeocode.GeoCoordination line”中,reverseGeocode是一个字段,但其用法与类型类似 ReverseGeocodeQuery reverseGeocode = new ReverseGeocodeQuery(); reverseGeocode.GeoCoordinate = new

ReverseGeocodeQuery出现错误

1.在“GeoCoordination(47.60887,-122.34094);”中,方法必须具有返回类型

2.在“reverseGeocode.GeoCoordination line”中,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;           
}
ReverseGeocodeQuery reverseGeocode=new ReverseGeocodeQuery();
reverseGeocode.GeoCoordinate=新的地理坐标(47.60887,-122.34094);
reverseGeocode.QueryCompleted+=reverseGeocode_QueryCompleted;
reverseGeocode.QueryAsync();
void reverseGeocode_QueryCompleted(objectsender,QueryCompletedEventArgs e)
{
MapAddress geoAddress=e.Result[0]。Information.Address;
}
我使用了名称空间——使用Microsoft.Phone.Maps.Services


如何纠正此错误。

得到了答案

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();

    }
GeoCoordinateWatcher myLocationWatcher;
专用地理坐标mycoordination=null;
私有异步void GetCurrentCoordinate()
{
Geolocator Geolocator=新的Geolocator();
geolocator.DesiredAccuracy=定位精度。高;
尝试
{
Geoposition currentPosition=等待geolocator.GetGeoPositionSync(TimeSpan.FromMinutes(1),TimeSpan.FromSeconds(10));
_精度=当前位置。坐标。精度;
mycoordination=新地理坐标(currentPosition.Coordinate.Latitude,currentPosition.Coordinate.Longitude);
如果(MyReverseGeocodeQuery==null | |!MyReverseGeocodeQuery.IsBusy)
{
MyReverseGeocodeQuery=新建ReverseGeocodeQuery();
MyReverseGeocodeQuery.GeoCoordinate=新的地理坐标(MyCoordination.Latitude、MyCoordination.Longitude);
LongitudeTextBlock.Text=mycoordinal.Longitude.ToString();
LatitudeTextBlock.Text=mycoordination.Latitude.ToString();
MyReverseGeocodeQuery.QueryCompleted+=ReverseGeocodeQuery\u QueryCompleted;
MyReverseGeocodeQuery.QueryAsync();
}
}
捕获(例外情况除外)
{
// ...
}
}
public void ReverseGeocodeQuery\u QueryCompleted(对象发送方,QueryCompletedEventArgs e)
{
如果(e.Error==null)
{
如果(e.Result.Count>0)
{
MapAddress address=e.Result[0]。Information.address;
labelResults.Text=“当前位置:“+地址.城市+”,“+地址.州;
}
}
}
公共作废按钮\单击(对象发送者,路由目标e)
{
GetCurrentCoordinate();
}