CivicAddressResolver.ResolveAddress(GeoCoordinate) 메서드

정의

위치 및 경도 기준 위치에서 도심 주소를 동기적으로 확인합니다. 이 호출은 주소를 확인하는 동안 호출 스레드의 실행을 차단하지 않습니다.

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 매개 변수에서 확인된 도심 주소입니다. 주소를 확인할 수 없으면 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 == false)
            {
                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 매개 변수에서 반환 되는 Address 의 멤버는 ResolveAddressCompletedEventArgs 이벤트 처리기에 전달 되는 개체입니다.

적용 대상