Bonjour,
je dois récupérer des infos depuis un serveur en AMF.
Pour cela il a été décidé d'utiliser la bibliothèque fluorineFX,
voici donc le code de ma classe:
j'ai juste un problème a la ligne ou il y a le commentaire //ligne du bug,
En effet il me sort un NullReferenceException
hors je test la variable pour pas qu'elle rentre dedans si elle est null
Merci d'avance pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 namespace spaceName { public class MyClass { private NetConnection maConnect; public delegate void TextGeneratedHandler(object sender, MonMsgHandler e); public event TextGeneratedHandler onTextChanged; public MyClass(){ } public void ping() { this.maConnect = new NetConnection(); ServerPingMsgHandler test = new MonMsgHandler(); this.maConnect.ObjectEncoding = FluorineFx.ObjectEncoding.AMF0; this.maConnect.Connect("URL"); this.maConnect.Call("method", test, null); if (test != null) { onTextChanged(this, test); //ligne du bug } } } public class MonMsgHandler : IPendingServiceCallback { private object MyReponse; public void ResultReceived(IPendingServiceCall call) { object result = call.Result; MyReponse = result; MessageBox.Show(result.ToString()); } public object getReponse() { return MyReponse; } } }
Partager