我在 wp7 中使用地理编码服务从纬度和经度获取 CountryName 我写了以下内容:-
GeoCoordinate location1 = null;
private GeoCoordinateWatcher watcher;
public void FindCountryUsingGps()
{
progressbar.Visibility = Visibility.Visible;
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
watcher.Start();
}
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
if (watcher != null)
{
watcher.Stop();
watcher.Dispose();
watcher = null;
location1 = e.Position.Location;
ObtainCountry();//by this function you obtain country region
}
}
然后添加了以下参考:- 之后我写了
public void ObtainCountry()
{
if (location == null)
return;
ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest();
但我不能写这个 ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest(); 线,它是红色的
在 wp7 中,这是什么?