2020-07-24 02:17:53 -07:00
|
|
|
using System;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
namespace SourceGit.UI {
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// General waiting dialog.
|
|
|
|
/// </summary>
|
|
|
|
public partial class Waiting : UserControl {
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Constructor.
|
|
|
|
/// </summary>
|
|
|
|
public Waiting() {
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Show this dialog.
|
|
|
|
/// </summary>
|
2020-08-03 01:23:00 -07:00
|
|
|
/// <param name="repo"></param>
|
2020-07-24 02:17:53 -07:00
|
|
|
/// <param name="job"></param>
|
2020-08-03 01:23:00 -07:00
|
|
|
public static void Show(Git.Repository repo, Action job) {
|
2020-07-24 02:17:53 -07:00
|
|
|
var dialog = new Waiting();
|
2020-08-06 00:41:25 -07:00
|
|
|
var popup = repo.GetPopupManager();
|
2020-08-03 01:23:00 -07:00
|
|
|
|
|
|
|
popup?.Show(dialog);
|
|
|
|
popup?.Lock();
|
2020-07-24 02:17:53 -07:00
|
|
|
Task.Run(() => {
|
|
|
|
job.Invoke();
|
|
|
|
dialog.Dispatcher.Invoke(() => {
|
2020-08-03 01:23:00 -07:00
|
|
|
popup?.Close(true);
|
2020-07-24 02:17:53 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|