CivicAddress.Unknown Campo
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Representa un objeto CivicAddress que no contiene datos.
public: static initonly System::Device::Location::CivicAddress ^ Unknown;
public static readonly System.Device.Location.CivicAddress Unknown;
staticval mutable Unknown : System.Device.Location.CivicAddress
Public Shared ReadOnly Unknown As CivicAddress
Valor de campo
Ejemplos
En el ejemplo siguiente se usa IsUnknown para comprobar el CivicAddress que se devuelve antes de ResolveAddress que se imprima la dirección civil.
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
Comentarios
Use IsUnknown para comprobar si un CivicAddress objeto contiene datos.
Se aplica a
Col·laboreu amb nosaltres a GitHub
La font d'aquest contingut es pot trobar al GitHub, on també podeu crear i revisar problemes i sol·licituds d'extracció. Per obtenir més informació, consulteu la nostra guia per a col·laboradors.