WebClient.OpenReadCompleted Evento

Definizione

Si verifica al completamento di un'operazione asincrona di apertura di un flusso contenente una risorsa.Occurs when an asynchronous operation to open a stream containing a resource completes.

public:
 event System::Net::OpenReadCompletedEventHandler ^ OpenReadCompleted;
public event System.Net.OpenReadCompletedEventHandler OpenReadCompleted;
member this.OpenReadCompleted : System.Net.OpenReadCompletedEventHandler 
Public Custom Event OpenReadCompleted As OpenReadCompletedEventHandler 
Public Event OpenReadCompleted As OpenReadCompletedEventHandler 

Tipo evento

OpenReadCompletedEventHandler

Esempio

Nell'esempio di codice riportato di seguito viene illustrata l'impostazione di un gestore eventi per questo evento.The following code example demonstrates setting an event handler for this event.

void OpenResourceForReading2( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);

   client->OpenReadCompleted += gcnew OpenReadCompletedEventHandler( OpenReadCallback2 );
   client->OpenReadAsync( uri );
}
public static void OpenResourceForReading2(string address)
{
    WebClient client = new WebClient();
    Uri uri = new Uri(address);

    client.OpenReadCompleted += new OpenReadCompletedEventHandler(OpenReadCallback2);
    client.OpenReadAsync(uri);
}
Public Shared Sub OpenResourceForReading2(ByVal address As String)

    Dim client As WebClient = New WebClient()
    AddHandler client.OpenReadCompleted, AddressOf OpenReadCallback2
                Dim uri as Uri = New Uri(address)
    client.OpenReadAsync(uri)
End Sub

Commenti

Questo evento viene generato ogni volta che viene completata un'operazione asincrona di apertura di un flusso contenente una risorsa.This event is raised each time an asynchronous operation to open a stream containing a resource completes. Queste operazioni vengono avviate chiamando i OpenReadAsync metodi.These operations are started by calling the OpenReadAsync methods.

OpenReadCompletedEventHandlerÈ il delegato per questo evento.The OpenReadCompletedEventHandler is the delegate for this event. La OpenReadCompletedEventArgs classe fornisce il gestore eventi con i dati dell'evento.The OpenReadCompletedEventArgs class provides the event handler with event data.

Per altre informazioni su come gestire gli eventi, vedere la gestione e generazione di eventi.For more information about how to handle events, see Handling and Raising Events.

Si applica a