ICivicAddressResolver.ResolveAddressCompleted 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ResolveAddressAsync(GeoCoordinate)를 사용하여 위도/경도를 도심 주소로 확인하는 비동기 요청이 완료될 때 발생합니다.
public:
event EventHandler<System::Device::Location::ResolveAddressCompletedEventArgs ^> ^ ResolveAddressCompleted;
event EventHandler<System.Device.Location.ResolveAddressCompletedEventArgs> ResolveAddressCompleted;
member this.ResolveAddressCompleted : EventHandler<System.Device.Location.ResolveAddressCompletedEventArgs>
Event ResolveAddressCompleted As EventHandler(Of ResolveAddressCompletedEventArgs)
이벤트 유형
예제
다음 예제에서는 호출 하는 방법을 보여 줍니다 ResolveAddressAsync 처리는 ResolveAddressCompleted 이벤트입니다.
static void ResolveAddressAsync()
{
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
bool started = false;
watcher.MovementThreshold = 1.0; // set to one meter
started = watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));
if (started)
{
CivicAddressResolver resolver = new CivicAddressResolver();
resolver.ResolveAddressCompleted += new EventHandler<ResolveAddressCompletedEventArgs>(resolver_ResolveAddressCompleted);
if (watcher.Position.Location.IsUnknown == false)
{
resolver.ResolveAddressAsync(watcher.Position.Location);
}
}
}
static void resolver_ResolveAddressCompleted(object sender, ResolveAddressCompletedEventArgs e)
{
if (!e.Address.IsUnknown)
{
Console.WriteLine("Country: {0}, Zip: {1}",
e.Address.CountryRegion,
e.Address.PostalCode);
}
else
{
Console.WriteLine("Unknown address.");
}
}
Public Sub ResolveCivicAddressAsync()
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))
If started Then
Dim resolver As CivicAddressResolver = New CivicAddressResolver()
AddHandler resolver.ResolveAddressCompleted, AddressOf resolver_ResolveAddressCompleted
If Not watcher.Position.Location.IsUnknown Then
resolver.ResolveAddressAsync(watcher.Position.Location)
End If
End If
watcher.Start()
End Sub
Sub resolver_ResolveAddressCompleted(ByVal sender As Object, ByVal e As ResolveAddressCompletedEventArgs)
If Not e.Address.IsUnknown Then
Console.WriteLine("Country: {0}, Zip: {1}",
e.Address.CountryRegion,
e.Address.PostalCode)
Else
Console.WriteLine("Unknown address.")
End If
End Sub
적용 대상
추가 정보
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET