I'm using FluorineFx to send/receive AMF3 data over server.
netConnection.Call("my-amf", "zend", "Ka_Services_Park", "getCompleteParkOfUser", new GetCustomersHandler(), new object[] { "msg_2580671638", "20251876" });
public class GetCustomersHandler : IPendingServiceCallback
{
public void ResultReceived(IPendingServiceCall call)
{
object result = call.Result;
}
}
i want to return response from class GetCustomersHandler to class from was called i called GetCustomersHandler in netConnection.Call in Form1 class, i want to return/get response (object result) from GetCustomersHandler to Form1.
Have your callback object store the result as a property.
public class GetCustomersHandler : IPendingServiceCallback
{
GetCustomersHandler()
{
this.Signal = new ManualResetEvent(false);
}
public void ResultReceived(IPendingServiceCall call)
{
this.Result = call.Result;
this.Signal.Set();
}
public ManualResetEvent Signal { get; protected set; }
public object Result { get; protected set; }
}
In the calling function, hold on to your callback object. Then when netConnection.Call()
returns, you can retrieve the value
GetCustomersHandler callback = new GetCustomersHandler();
netConnection.Call("my-amf", "zend", "Ka_Services_Park", "getCompleteParkOfUser", callback, new object[] { "msg_2580671638", "20251876" });
callback.WaitOne();
object result = callback.Result;