|
I'm trying to save an attachment I get from a byte[] from a webservice. The problem is that my code continues even before the completed event of the method could have been called. Is there some way to let the application wait for that event. This is the part where I save the attachment as byes:
And this is how I try to get the byte[]:
The Async call takes to long to finish... Is there any way to speed the process of fetching the attachment up or another way to fix that problem? |
|
I assume your webservice offers a synchronous This is Microsoft's Event-based Asynchronous Pattern and the right solution would be to rewrite your application a bit (see the links for more info) to take advantage of it. Basically, what you need are two methods on your application's form - one that starts the operation (and does not return anything), and another that handles the SaveAttachmentCompleted event (which would get called when the operation is done). Speeding up the process of attachment fetching would not help. The |