In the following code I disable button before processing tasks and would like to enable it after all tasks are finished.
List<Task> tasks = new List<Task>();
buttonUpdateImage.Enabled = false; // disable button
foreach (OLVListItem item in cellsListView.CheckedItems)
{
    Cell c = (Cell)(item.RowObject);
    var task = Task.Factory.StartNew(() =>
    {
        Process p = new Process();
        ...
        p.Start();
        p.WaitForExit();
    });
    task.ContinueWith(t => c.Status = 0);
    tasks.Add(task);
}
Task.WaitAll(tasks.ToArray());
// enable button here
WaitAll is blocking the UI thread. How can I wait until all tasks finish and then enable the button?
 
     
     
     
     
    