ResolveAddressCompletedEventArgs Clase

Definición

Proporciona datos para el evento ResolveAddressCompleted.

public ref class ResolveAddressCompletedEventArgs : System::ComponentModel::AsyncCompletedEventArgs
public class ResolveAddressCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
type ResolveAddressCompletedEventArgs = class
    inherit AsyncCompletedEventArgs
Public Class ResolveAddressCompletedEventArgs
Inherits AsyncCompletedEventArgs
Herencia
ResolveAddressCompletedEventArgs

Ejemplos

En el ejemplo siguiente se muestra cómo usar .ResolveAddressCompletedEventArgs

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

Constructores

ResolveAddressCompletedEventArgs(CivicAddress, Exception, Boolean, Object)

Inicializa una nueva instancia de la clase ResolveAddressCompletedEventArgs.

Propiedades

Address

Obtiene el objeto CivicAddress asociado al evento ResolveAddressCompleted.

Cancelled

Obtiene un valor que indica si se ha cancelado una operación asincrónica.

(Heredado de AsyncCompletedEventArgs)
Error

Obtiene un valor que indica el error que se produjo durante una operación asincrónica.

(Heredado de AsyncCompletedEventArgs)
UserState

Obtiene el identificador único de la tarea asincrónica.

(Heredado de AsyncCompletedEventArgs)

Métodos

Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()

Sirve como la función hash predeterminada.

(Heredado de Object)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
RaiseExceptionIfNecessary()

Genera una excepción proporcionada por el usuario si se ha producido un error en una operación asincrónica.

(Heredado de AsyncCompletedEventArgs)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Se aplica a