0

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 で、これは何ですか?

4

1 に答える 1

0

サービス参照を削除/再追加してみてください。コードが正しく生成されないという問題が時々ありました。このコードは、Reference.cs というコード ファイルの ServiceReference フォルダーの下にある必要があります。

于 2012-05-02T18:54:17.667 に答える