Faire remonter l'argument d'un Event
Bonjour,
La methode suivante appartient à la classe "Connexion" elle est appellée depuis une autre classe "Résultat".
J'aimerai faire remonter dans la classe "Résultat" l'argument e de type DownloadStringCompletedEventArgs car c'est lui qui contient mon objet XML que je traite dans cette classe.
Comment m'y prendre ?
Merci d'avance
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
public void DownloadAsync(string password, string user, string domain, string critere)
{
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.Credentials = new NetworkCredential(user, password, domain);
client.DownloadStringAsync(new Uri(URL_RECHERCHE + critere));
}
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show("Erreur : " + e.Error.Message);
return; // A faire : gérer l'erreur.
}
} |