In my WPF client, I have a loop that calls a WCF service to update some records. When the loop is done, I display a message, "Update complete".
I'm changing my WCF calls to async calls now.
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 don't need to do anything in the competed event of each operation. I need to just display a message at the end of the last one.
Any ideas?
EDIT: I may be porting this to Silverlight, so that's why I need to call the service asyncronously. I don't think I can use the background worker.