Compartilhar via


ResolveAddressCompletedEventArgs Classe

Definição

Fornece dados para o evento de ResolveAddressCompleted .

public ref class ResolveAddressCompletedEventArgs : System::ComponentModel::AsyncCompletedEventArgs
public class ResolveAddressCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
type ResolveAddressCompletedEventArgs = class
    inherit AsyncCompletedEventArgs
Public Class ResolveAddressCompletedEventArgs
Inherits AsyncCompletedEventArgs
Herança
ResolveAddressCompletedEventArgs

Exemplos

O exemplo a seguir mostra como usar o 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

Construtores

ResolveAddressCompletedEventArgs(CivicAddress, Exception, Boolean, Object)

Inicializa uma nova instância de ResolveAddressCompletedEventArgs.

Propriedades

Address

Obtém o CivicAddress associado ao evento ResolveAddressCompleted.

Cancelled

Obtém um valor que indica se uma operação assíncrona foi cancelada.

(Herdado de AsyncCompletedEventArgs)
Error

Obtém um valor que indica qual erro ocorreu durante uma operação assíncrona.

(Herdado de AsyncCompletedEventArgs)
UserState

Obtém o identificador exclusivo para a tarefa assíncrona.

(Herdado de AsyncCompletedEventArgs)

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
RaiseExceptionIfNecessary()

Gera uma exceção fornecida pelo usuário se uma operação assíncrona falhou.

(Herdado de AsyncCompletedEventArgs)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Aplica-se a