title: How to call multiple invoke operations one by one?
body: <p>I have some invoke operations (all different) that I need to call based on the user selected items that are stored in an <code>ObservableCollection</code> and return a string/int value.</p>
  
  <p>Now when the selection is only one item it is straight forward, I can call and use the <code>Completed</code> event and get my return value.</p>
  
  <p>I have approx &lt;= 8 items in the list I need to iterate and perform the <code>invoke</code> operation on each.</p>
  
  <p>I see the <code>foreach</code> will not really wait for the <code>InvokeOperation</code> to finish  and just continuously iterates till the end of the list making them run in parallel..sort of...</p>
  
  <p>How do I perform only one operation at once and iterate only when the previous operation is completed (irrespective of the result)? </p>
  
  <p>1 by 1 execution of InvokeOperations is what I'm looking for..any clues, hints..?</p>
  
  <p>Let me know if I'm unclear..</p>
  
  <p>Cheers.</p>
  
  <p>EDIT: The <code>InvokeOperation</code>(s) are different from each other. Each of them doin different operations on the DB which can be time consuming.The main reason for looking into executing them 1-1 is to update the user screen with the output (success/fail) for each of them and not do all at once.</p>
  
  <pre><code>//Pseudo-code
  foreach (var item in SelectedItems) 
  {
  
      var id = item.ID;
  
      switch(id) 
      {    
        case: 1
           InvokeOperataion&lt;int&gt; inv = context.PerformUpdateFor_1(item);
           inv.Completed += (s,a) =&gt; { 
           //get the value assign it to Textblock.
           };
           break;
        case: 2
           InvokeOperataion&lt;int&gt; inv = context.PerformUpdateFor_2(item);
           inv.Completed += (s,a) =&gt; { 
           //get the value assign it to Textblock.
           };
           break;
  //Other cases similar to this    
     }
  
  }
  </code></pre>