Thursday, 15 August 2013

How to get method results with AsyncCallback?

How to get method results with AsyncCallback?

I hope you can help me with the following:
I have a WebService method which is supposed to return an array of
CompensationPlanReturnReturn objects. The method is called like this:
//This is the object I need to instanciate because it contains the method
I wanna call
CompensationPlan_Out_SyncService test = new
CompensationPlan_Out_SyncService();
//This is the method that is supposed to return me an array of
CompensationPlanReturnReturn objects
//The data.ToArray() is the parameter the method need, then I pass the
method that I wanna run when the method finishes and I dont know what to
pass as the final parameter
test.BeginCompensationPlan_Out_Sync(data.ToArray(), new
AsyncCallback(complete), null)
//The method description is:
public System.IAsyncResult
BeginCompensationPlan_Out_Sync(CompensationPlanDataCompensationPlan[]
CompensationPlanRequest, System.AsyncCallback callback, object asyncState)
//On this method I'd like to access to the resuls (the array of
CompensationPlanReturnReturn) but I dont know how
private void complete(IAsyncResult result)
{
lblStatus.Text = "Complete";
}

No comments:

Post a Comment