refactor(PopupManager): rewrite popup

This commit is contained in:
leo 2020-08-06 15:41:25 +08:00
parent 28e3a1bb27
commit 7558bbd4f2
34 changed files with 183 additions and 221 deletions

View file

@ -8,34 +8,27 @@ namespace SourceGit.UI {
/// `git init` confirm panel.
/// </summary>
public partial class Init : UserControl {
private PopupManager popup = null;
private string workingDir = null;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="mgr"></param>
/// <param name="path"></param>
public Init(string path) {
public Init(PopupManager mgr, string path) {
popup = mgr;
workingDir = path;
InitializeComponent();
txtPath.Content = path;
}
/// <summary>
/// Show this dialog.
/// </summary>
/// <param name="path"></param>
public static void Show(string path) {
var popup = App.GetPopupManager(null);
popup.Show(new Init(path));
}
/// <summary>
/// Do `git init`
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void Sure(object sender, RoutedEventArgs e) {
var popup = App.GetPopupManager(null);
popup.Lock();
await Task.Run(() => {
@ -59,7 +52,7 @@ namespace SourceGit.UI {
/// <param name="sender"></param>
/// <param name="e"></param>
private void Cancel(object sender, RoutedEventArgs e) {
App.GetPopupManager(null).Close();
popup.Close();
}
}
}