private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var backgroundWorker = (BackgroundWorker)sender;

            while (!e.Cancel)
            {
                if (backgroundWorker.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
                else
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        AliveDead.ButtonValues();
                        livesText.Text = "Alive: " + Convert.ToString(AliveDead.Next());
                        // could add an if statement to check if all boxes are false
                        // if true, call StopLoop();
                    });
                    Thread.Sleep(speed);
                }
            }
        }
 private void NextButton_Click(object sender, RoutedEventArgs e)
 {
     AliveDead.ButtonValues();
     livesText.Text = "Alive: " + Convert.ToString(AliveDead.Next());
 }