private void UpdateProgressBar() { Dispatcher.Invoke(() => { progressBar.Value++; var countLeft = auto.GetCountLeft(); textBoxTotal.Text = (countLeft * ONE_THROW_COST).ToString(); btnStart.IsEnabled = countLeft <= 0; }); }