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

@ -58,9 +58,7 @@ namespace SourceGit.UI {
dialog.basedOnDesc.Content = branch.Name;
if (!branch.IsLocal) dialog.txtName.Text = branch.Name.Substring(branch.Remote.Length + 1);
var popup = App.GetPopupManager(repo);
popup?.Show(dialog);
repo.GetPopupManager()?.Show(dialog);
}
/// <summary>
@ -74,8 +72,7 @@ namespace SourceGit.UI {
dialog.basedOnType.Data = dialog.FindResource("Icon.Tag") as Geometry;
dialog.basedOnDesc.Content = tag.Name;
var popup = App.GetPopupManager(repo);
popup?.Show(dialog);
repo.GetPopupManager()?.Show(dialog);
}
/// <summary>
@ -89,8 +86,7 @@ namespace SourceGit.UI {
dialog.basedOnType.Data = dialog.FindResource("Icon.Commit") as Geometry;
dialog.basedOnDesc.Content = $"{commit.ShortSHA} {commit.Subject}";
var popup = App.GetPopupManager(repo);
popup?.Show(dialog);
repo.GetPopupManager()?.Show(dialog);
}
/// <summary>
@ -102,7 +98,7 @@ namespace SourceGit.UI {
txtName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
if (Validation.GetHasError(txtName)) return;
var popup = App.GetPopupManager(repo);
var popup = repo.GetPopupManager();
popup?.Lock();
bool checkout = chkCheckout.IsChecked == true;
@ -135,7 +131,7 @@ namespace SourceGit.UI {
/// <param name="sender"></param>
/// <param name="e"></param>
private void Cancel(object sender, RoutedEventArgs e) {
App.GetPopupManager(repo)?.Close();
repo.GetPopupManager()?.Close();
}
}
}