AsyncCompletedEventHandler AsyncCompletedEventHandler AsyncCompletedEventHandler AsyncCompletedEventHandler Delegate

Definition

Representa el método que controlará el evento MethodNameCompleted de una operación asincrónica. Represents the method that will handle the MethodNameCompleted event of an asynchronous operation.

public delegate void AsyncCompletedEventHandler(System::Object ^ sender, AsyncCompletedEventArgs ^ e);
public delegate void AsyncCompletedEventHandler(object sender, AsyncCompletedEventArgs e);
type AsyncCompletedEventHandler = delegate of obj * AsyncCompletedEventArgs -> unit
Public Delegate Sub AsyncCompletedEventHandler(sender As Object, e As AsyncCompletedEventArgs)

Parámetros

sender
Object Object Object Object

Origen del evento. The source of the event.

Inheritance
AsyncCompletedEventHandlerAsyncCompletedEventHandlerAsyncCompletedEventHandlerAsyncCompletedEventHandler

Examples

Para obtener un ejemplo de código de la AsyncCompletedEventHandler delegado, vea el ejemplo de la System.ComponentModel.AsyncCompletedEventArgs clase.For a code example of the AsyncCompletedEventHandler delegate, see the example in the System.ComponentModel.AsyncCompletedEventArgs class.

Remarks

Cuando se crea un delegado AsyncCompletedEventHandler, se identifica el método que controlará el evento.When you create an AsyncCompletedEventHandler delegate, you identify the method that will handle the event. Para asociar el evento al controlador, se debe agregar una instancia del delegado al evento.To associate the event with your event handler, add an instance of the delegate to the event. Se llama al método de controlador de eventos cada vez que se produce el evento, a menos que quite al delegado.The event-handler method is called whenever the event occurs, unless you remove the delegate. Para obtener más información sobre los delegados de controlador de eventos, consulte controlar y provocar eventos.For more information about event-handler delegates, see Handling and Raising Events.

Para un método asincrónico, denominado MethodName, en el componente, tendrá una correspondiente MethodName Completed eventos y opcional MethodName CompletedEventArgs clase.For an asynchronous method, called MethodName, in your component, you will have a corresponding MethodNameCompleted event, and an optional MethodNameCompletedEventArgs class.

Para un componente que admite varias invocaciones simultáneas de sus métodos asincrónicos, el cliente puede proporcionar un token único o Id. de tarea, para distinguir qué tarea asincrónica está generando eventos concretos.For a component that supports multiple concurrent invocations of its asynchronous methods, the client can supply a unique token, or task ID, to distinguish which asynchronous task is raising particular events. El cliente AsyncCompletedEventHandler puede leer el AsyncCompletedEventArgs.UserState propiedad para determinar qué tarea está informando de finalización.The client's AsyncCompletedEventHandler can read the AsyncCompletedEventArgs.UserState property to determine which task is reporting completion. La implementación debe utilizar el System.ComponentModel.AsyncOperationManager para crear un System.ComponentModel.AsyncOperation que asocia la tarea del cliente con los identificadores de las tareas asincrónicas pendientes.Your implementation should use the System.ComponentModel.AsyncOperationManager to create an System.ComponentModel.AsyncOperation that associates the client's task IDs with pending asynchronous tasks.

Applies to

See Also