using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace VideoConcat { public static class ProcessVideo { public static void RunTask(System.Windows.Controls.ProgressBar progressBar, System.Windows.Controls.Button btn) { for (int i = 0; i <= 100; i++) { Application.Current.Dispatcher.Invoke(() => { progressBar.Dispatcher.Invoke(() => { progressBar.Value = i; }); }); System.Threading.Thread.Sleep(50); } btn.Dispatcher.Invoke(() => { btn.IsEnabled = true; }); } } }