mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
38 lines
960 B
C#
38 lines
960 B
C#
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>
|
|
/// <param name="repo"></param>
|
|
/// <param name="job"></param>
|
|
public static void Show(Git.Repository repo, Action job) {
|
|
var dialog = new Waiting();
|
|
var popup = App.Launcher.GetPopupManager(repo);
|
|
|
|
popup?.Show(dialog);
|
|
popup?.Lock();
|
|
Task.Run(() => {
|
|
job.Invoke();
|
|
dialog.Dispatcher.Invoke(() => {
|
|
popup?.Close(true);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|