c# - ASMX webservices with Silverlight Async confusion -


I have a Silverlight 4 web app that needs to communicate with a server via access to the ASMX web service on the server . I have a list (yes, array), which I need to send as a parameter for service (one by one) though running looping and method (object) from the list; Will not work because I need to send one after the other and Silverlight only supports ASCIN (possibly without a lockup interface - it makes sense)

So I tried to do this:

  Public Zero SendNextPart () {if (partsToSend.Count> gt; 0) {part thisPart = partsToSend.Dequeue () ; FuWS.createPartCompleted + = New Event Handler & lt; System.ComponentModel.AsyncCompletedEventArgs & gt; (FuWS_createPartCompleted); FuWS.createPartAsync (thisPart); }} Queue & lt; Part & gt; PartsToSend = new line & lt; Part & gt; (); Zero fuWS_createPartcompleted (Object Sender, System.ComponentModel.AsyncCompletedEventArgs e) {SendNextPart (); }  

Which, as far as I can understand it, to see whether to send the portion to the list, then called webservice and from the parts You will see that part deleted. List Once this whole incident happens, then it should run the SendNextPart method again and send it to the next part.

Although what is going on (seeing HTTPwatch it has been lifted) it sends the first part, then thereafter sends 2 parts at once and after that, all in one go. Almost entirely, the event has been sent to the server before receiving this and the method is being run successfully.

Please help, it is angry with my hell, and it breaks completely which I want to do: '(

I do not see the SendNextBuffer method calling in the Web service callback event handler but in any case, the position of the race in your code is the most If the web service is completed and executed (theoretically possible) of the partsToSend.RemoveAt line) State giving Sent remove before you can next request.

So first, you should check to make sure that you have included all the code in your example, unless you mean it SendNextBuffer to say SendNextPart .

The second, call you the partsToSend.RemoveAt line before the web service.

In the end, you should be supporting the Partostond list with the Queue & lt; Part & gt; (first, first out) or stack & lt; Part & gt; (last time, first out) are using it again.


Comments