title: Multiple async webclient calls in backgroundworker (Silverlight 4)
body: <p><strong>Requirement</strong>: </p>
  
  <ul>
  <li>A Silverlight client that loads a file from the user's computer. </li>
  <li>For each row in the file it needs to issue a GET to a url and either approve or reject the row based on the JSON validation message returned. </li>
  <li>When all rows have completed, show the user a summary of how many rows passed and how many failed.</li>
  </ul>
  
  <p>I would have preferred doing this "synchronously" in the BackgroundWorker, but that breaks the SL async thinking.</p>
  
  <p>My code currently passes the result from the OpenFileDialog to a BackgroundWorker which reads the file into a list of strongly typed objects (client side validation). I create a WebClient and call DownloadStringAsync multiple times as I loop over the lines. More often than not, the background worker completes and runs the completed event method long before the WebClient is completed. The UI thread can run as async as it wants, but I need to either wait with completing the backgroundworker thread until it is actually finished getting the data, or have some additional event handler that works when all (hundreds) of rows have been validated.</p>
  
  <p>What is best practice when wanting to handle the last Completed event of X total events? Any use of auto reset events here that could help?</p>