2012-07-19 2 views
1

Bing Maps WPF 컨트롤과 SOAP 서비스를 사용하여 지점을 지오 코딩하는 과정을 취소하려고합니다. 나는 this project에서 일부 코드, 코드 특히이 블록을 구현하기 위해 노력 :Bing Maps 자격 증명이 없습니까?

private string ReverseGeocodePoint(string locationString) 
      { 
       string results = ""; 
       ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest(); 

       // Set the credentials using a valid Bing Maps key 
       reverseGeocodeRequest.Credentials = new GeocodeService.Credentials(); 
       reverseGeocodeRequest.Credentials.ApplicationId = key; 

       // Set the point to use to find a matching address 
       GeocodeService.Location point = new GeocodeService.Location(); 
       string[] digits = locationString.Split(';'); 

       point.Latitude = double.Parse(digits[0].Trim()); 
       point.Longitude = double.Parse(digits[1].Trim()); 

       reverseGeocodeRequest.Location = point; 

       // Make the reverse geocode request 
       GeocodeServiceClient geocodeService = new GeocodeServiceClient(); 
       GeocodeResponse geocodeResponse = geocodeService.ReverseGeocode(reverseGeocodeRequest); 

       if (geocodeResponse.Results.Length > 0) 
        results = geocodeResponse.Results[0].DisplayName; 
       else 
        results = "No Results found"; 

       return results; 
      } 
그러나

, 나는 그것을 구현하려고 할 때, 나는 말했다되고있어 :

reverseGeocodeRequest.Credentials = new GeocodeService.Credentials(); 
: Error: The type or namespace name 'Credentials' does not exist in the namespace 'GeocodeTest.GeocodeService' (are you missing an assembly reference?)이 오류는 라인에서 발생

호기심 나는 개체 참조를 통해 서비스 참조를 살펴보기로 결정했습니다. 분명히 내 GeocodeService에는 Credentials 회원이 없습니다. 이제 질문은 :

  • I는 회원 자신을 추가해야 하는가? 그렇다면 어떻게해야합니까?
  • 그렇지 않은 경우 자격 증명을 제공하기위한 대안은 무엇입니까?

답변

2

Credentials 네임 스페이스/유형은 서비스 참조 GeocodeText.GeocodeService 존재하지 않습니다. 대신 Bing Maps WPF 컨트롤에서 Credentials을 사용해야합니다. 성명은 다음과 같이 보입니다 :

reverseGeocodeRequest.Credentials = new Microsoft.Maps.MapControl.WPF.Credentials(); 
관련 문제