using System; using System.Threading.Tasks; using System.Windows.Controls; namespace SourceGit.UI { /// /// General waiting dialog. /// public partial class Waiting : UserControl { /// /// Constructor. /// public Waiting() { InitializeComponent(); } /// /// Show this dialog. /// /// public static void Show(Action job) { var dialog = new Waiting(); PopupManager.Show(dialog); PopupManager.Lock(); Task.Run(() => { job.Invoke(); dialog.Dispatcher.Invoke(() => { PopupManager.Close(true); }); }); } } }