I'm trying to emulate a process where buttons are sequentially getting set to one colour then back to their previous colour every few seconds.
Problem is, I am not entirely sure how to iterate through a collection without blocking the UI thread... i don't like using thread.sleep but this is what i found on SO.
Anyone aid me? Posting code I have below for Start button click
    private void StartTest_Click(object sender, RoutedEventArgs e)
    {
        //tabControl.SelectedIndex = 3;
        // Emulate buttons being processed
        Dispatcher.Invoke(() =>
        {
            new Task(() =>
            {
                selectedButtons.All(bSelected=>
                {
                    bSelected.Background = resourceDictionary["ProcessingButtonColour"] as Brush;
                    Thread.Sleep(3000);
                    bSelected.Background = resourceDictionary["HoverOverColourInactive"] as Brush;
                    return true;
                });
            }).Start();
        });
    }
 
    