다음을 통해 공유


CivicAddress.IsUnknown 속성

정의

CivicAddress에 데이터가 있는지 여부를 나타내는 값을 가져옵니다.

public:
 property bool IsUnknown { bool get(); };
public bool IsUnknown { get; }
member this.IsUnknown : bool
Public ReadOnly Property IsUnknown As Boolean

속성 값

CivicAddressUnknown과 같으면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 IsUnknown 검사할 합니다 CivicAddress 에서 반환 되는 ResolveAddress 도심 주소를 인쇄 하기 전에 합니다.

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.");
        }
    }
}

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

적용 대상