In my WPF client, I have a loop that calls the WCF service to update some records. When the cycle is completed, I post the message "Update completed."
I am changing my WCF calls to asynchronous calls.
ServiceClient client = new ServiceClient();
client.UpdateRecordsCompleted +=new System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(client_UpdateRecordsCompleted);
foreach (MyItem item in someCollection)
{
client.UpdateRecordsAsync(item);
}
MessageBox.Show("Update complete");
I do not need to do anything in the competition event of each operation. I just need to display a message at the end of the last.
Any ideas?
EDIT: I can port this to Silverlight, so I need to call the service asynchronously. I donβt think I can use a desktop background.
source
share