CivicAddressResolver.ResolveAddress(GeoCoordinate) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
위도 및 경도에 따라 위치에서 시민 주소를 동기적으로 확인합니다. 이 호출은 주소가 확인되는 동안 호출 스레드의 실행을 차단합니다.
public:
virtual System::Device::Location::CivicAddress ^ ResolveAddress(System::Device::Location::GeoCoordinate ^ coordinate);
public System.Device.Location.CivicAddress ResolveAddress(System.Device.Location.GeoCoordinate coordinate);
abstract member ResolveAddress : System.Device.Location.GeoCoordinate -> System.Device.Location.CivicAddress
override this.ResolveAddress : System.Device.Location.GeoCoordinate -> System.Device.Location.CivicAddress
Public Function ResolveAddress (coordinate As GeoCoordinate) As CivicAddress
매개 변수
- coordinate
- GeoCoordinate
GeoCoordinate 시민 주소로 확인할 위치가 포함된 위치입니다.
반품
매개 변수에서 coordinate 확인된 civic 주소입니다.
Unknown 은 주소를 확인할 수 없는 경우 반환됩니다.
구현
예외
coordinate은 null입니다.
coordinate 는 유효한 위도 및 경도를 포함하지 않습니다.
예제
다음 프로그램은 시민 주소를 동기적으로 해결하기 위해 호출 ResolveAddress 하는 방법을 보여 줍니다.
using System;
using System.Device.Location;
namespace ResolveAddressSync
{
class Program
{
static void Main(string[] args)
{
ResolveAddressSync();
}
static void ResolveAddressSync()
{
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
watcher.MovementThreshold = 1.0; // set to one meter
watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));
CivicAddressResolver resolver = new CivicAddressResolver();
if (!watcher.Position.Location.IsUnknown)
{
CivicAddress address = resolver.ResolveAddress(watcher.Position.Location);
if (!address.IsUnknown)
{
Console.WriteLine("Country: {0}, Zip: {1}",
address.CountryRegion,
address.PostalCode);
}
else
{
Console.WriteLine("Address unknown.");
}
}
}
}
}
Imports System.Device.Location
Module ResolveAddressSync
Public Sub ResolveAddressSync()
Dim watcher As GeoCoordinateWatcher
watcher = New System.Device.Location.GeoCoordinateWatcher(GeoPositionAccuracy.High)
Dim started As Boolean = False
watcher.MovementThreshold = 1.0 'set to one meter
started = watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))
Dim resolver As CivicAddressResolver = New CivicAddressResolver()
If started Then
If Not watcher.Position.Location.IsUnknown Then
Dim address As CivicAddress = resolver.ResolveAddress(watcher.Position.Location)
If Not address.IsUnknown Then
Console.WriteLine("Country: {0}, Zip: {1}",
address.CountryRegion,
address.PostalCode)
Else
Console.WriteLine("Address unknown.")
End If
End If
Else
Console.WriteLine("GeoCoordinateWatcher timed out on start.")
End If
End Sub
Public Sub Main()
ResolveAddressSync()
Console.WriteLine("Enter any key to quit.")
Console.ReadLine()
End Sub
End Module
설명
주소 ResolveAddressCompleted 확인 작업이 완료되면 이벤트가 발생합니다. 매개 변수에서 coordinate 확인된 civic 주소는 이벤트 처리기에 전달되는 개체의 ResolveAddressCompletedEventArgs 멤버에 의해 Address 반환됩니다.