mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
optimize(*): move App.Launcher.GetPopupManager to App.GetPopupManager
This commit is contained in:
parent
3c24eaa6a7
commit
5066b974a1
34 changed files with 126 additions and 133 deletions
|
@ -36,14 +36,6 @@ namespace SourceGit {
|
|||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get main window.
|
||||
/// </summary>
|
||||
public static UI.Launcher Launcher {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raise error message.
|
||||
/// </summary>
|
||||
|
@ -52,6 +44,26 @@ namespace SourceGit {
|
|||
OnError?.Invoke(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get popup manager by repository
|
||||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
/// <returns></returns>
|
||||
public static UI.PopupManager GetPopupManager(Git.Repository repo) {
|
||||
var main = Current.MainWindow as UI.Launcher;
|
||||
if (main == null) return null;
|
||||
if (repo == null) return (main.Tabs[0].Page as UI.Manager).popupManager;
|
||||
|
||||
for (int i = 1; i < main.openedTabs.Items.Count; i++) {
|
||||
var opened = main.openedTabs.Items[i] as UI.Launcher.Tab;
|
||||
if (opened.Repo.Path == repo.Path) {
|
||||
return (opened.Page as UI.Dashboard).popupManager;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Startup event.
|
||||
/// </summary>
|
||||
|
@ -100,8 +112,8 @@ namespace SourceGit {
|
|||
}
|
||||
|
||||
// Show main window
|
||||
Launcher = new UI.Launcher();
|
||||
Launcher.Show();
|
||||
Current.MainWindow = new UI.Launcher();
|
||||
Current.MainWindow.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace SourceGit.UI {
|
|||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
public static void Show(Git.Repository repo) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new AddSubmodule(repo));
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace SourceGit.UI {
|
|||
if (Validation.GetHasError(txtPath)) return;
|
||||
|
||||
var recursive = chkRecursive.IsChecked == true;
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.AddSubmodule(RepoURL, LocalPath, recursive, msg => {
|
||||
|
@ -68,7 +68,7 @@ namespace SourceGit.UI {
|
|||
}
|
||||
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace SourceGit.UI {
|
|||
/// </summary>
|
||||
/// <param name="opened"></param>
|
||||
public static void Show(Git.Repository opened) {
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(new Apply(opened));
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace SourceGit.UI {
|
|||
txtPatchFile.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||
if (Validation.GetHasError(txtPatchFile)) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
var mode = combWhitespaceOptions.SelectedItem as WhitespaceOption;
|
||||
|
@ -99,7 +99,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace SourceGit.UI {
|
|||
double minWidth = content.ActualWidth;
|
||||
|
||||
// Move to center.
|
||||
var parent = App.Launcher;
|
||||
var parent = App.Current.MainWindow;
|
||||
Left = parent.Left + (parent.Width - Width) * 0.5;
|
||||
Top = parent.Top + (parent.Height - Height) * 0.5;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="commit"></param>
|
||||
public static void Show(Git.Repository repo, Git.Commit commit) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new CherryPick(repo, commit));
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace SourceGit.UI {
|
|||
private void Start(object sender, RoutedEventArgs e) {
|
||||
repo.CherryPick(commitSHA, chkCommitChanges.IsChecked != true);
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Close();
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace SourceGit.UI {
|
|||
/// Show clone dialog.
|
||||
/// </summary>
|
||||
public static void Show() {
|
||||
var popup = App.Launcher.GetPopupManager(null);
|
||||
var popup = App.GetPopupManager(null);
|
||||
popup?.Show(new Clone());
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace SourceGit.UI {
|
|||
rName = RemoteName;
|
||||
}
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(null);
|
||||
var popup = App.GetPopupManager(null);
|
||||
popup.Lock();
|
||||
|
||||
var repo = await Task.Run(() => {
|
||||
|
@ -113,7 +113,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(null).Close();
|
||||
App.GetPopupManager(null).Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace SourceGit.UI {
|
|||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
public static void Show(Git.Repository repo) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new Configure(repo));
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace SourceGit.UI {
|
|||
}
|
||||
|
||||
private void Close(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace SourceGit.UI {
|
|||
|
||||
if (!branch.IsLocal) dialog.txtName.Text = branch.Name.Substring(branch.Remote.Length + 1);
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(dialog);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace SourceGit.UI {
|
|||
dialog.basedOnType.Data = dialog.FindResource("Icon.Tag") as Geometry;
|
||||
dialog.basedOnDesc.Content = tag.Name;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(dialog);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ namespace SourceGit.UI {
|
|||
dialog.basedOnType.Data = dialog.FindResource("Icon.Commit") as Geometry;
|
||||
dialog.basedOnDesc.Content = $"{commit.ShortSHA} {commit.Subject}";
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(dialog);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ namespace SourceGit.UI {
|
|||
txtName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||
if (Validation.GetHasError(txtName)) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
bool checkout = chkCheckout.IsChecked == true;
|
||||
|
@ -135,7 +135,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace SourceGit.UI {
|
|||
dialog.basedOnType.Data = dialog.FindResource("Icon.Branch") as Geometry;
|
||||
dialog.basedOnDesc.Content = branch.Name;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(dialog);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace SourceGit.UI {
|
|||
dialog.basedOnType.Data = dialog.FindResource("Icon.Commit") as Geometry;
|
||||
dialog.basedOnDesc.Content = $"{commit.ShortSHA} {commit.Subject}";
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(dialog);
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace SourceGit.UI {
|
|||
|
||||
Git.Tag.Add(repo, TagName, based, tagMessage.Text);
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Close();
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
xmlns:local="clr-namespace:SourceGit.UI"
|
||||
xmlns:converters="clr-namespace:SourceGit.Converters"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Unloaded="Cleanup">
|
||||
<UserControl.Resources>
|
||||
<RoutedUICommand x:Key="OpenSearchBarCommand" Text="OpenSearchBar"/>
|
||||
<RoutedUICommand x:Key="HideSearchBarCommand" Text="HideSearchBar"/>
|
||||
|
|
|
@ -78,17 +78,6 @@ namespace SourceGit.UI {
|
|||
UpdateSubmodules();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup all items
|
||||
/// </summary>
|
||||
public void Cleanup() {
|
||||
localBranchTree.ItemsSource = null;
|
||||
remoteBranchTree.ItemsSource = null;
|
||||
tagList.ItemsSource = null;
|
||||
cachedLocalBranches.Clear();
|
||||
cachedRemotes.Clear();
|
||||
}
|
||||
|
||||
#region DATA_UPDATE
|
||||
private void UpdateHistories() {
|
||||
Dispatcher.Invoke(() => {
|
||||
|
@ -300,6 +289,14 @@ namespace SourceGit.UI {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void Cleanup(object sender, RoutedEventArgs e) {
|
||||
localBranchTree.ItemsSource = null;
|
||||
remoteBranchTree.ItemsSource = null;
|
||||
tagList.ItemsSource = null;
|
||||
cachedLocalBranches.Clear();
|
||||
cachedRemotes.Clear();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TOOLBAR
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="opened"></param>
|
||||
/// <param name="branch"></param>
|
||||
public static void Show(Git.Repository opened, Git.Branch branch) {
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(new DeleteBranch(opened, branch));
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Sure(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => branch.Delete(repo));
|
||||
popup?.Close(true);
|
||||
|
@ -50,7 +50,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="opened"></param>
|
||||
/// <param name="remote"></param>
|
||||
public static void Show(Git.Repository opened, string remote) {
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(new DeleteRemote(opened, remote));
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Sure(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => Git.Remote.Delete(repo, remote));
|
||||
popup?.Close(true);
|
||||
|
@ -51,7 +51,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="tag"></param>
|
||||
public static void Show(Git.Repository repo, Git.Tag tag) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new DeleteTag(repo, tag));
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Start(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
var push = chkWithRemote.IsChecked == true;
|
||||
|
@ -55,7 +55,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,19 +40,19 @@ namespace SourceGit.UI {
|
|||
/// <param name="opened"></param>
|
||||
/// <param name="targets"></param>
|
||||
public static void Show(Git.Repository opened, List<Git.Change> targets) {
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(new Discard(opened, targets));
|
||||
}
|
||||
|
||||
private async void Sure(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.Discard(changes));
|
||||
popup?.Close(true);
|
||||
}
|
||||
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="preferRemote"></param>
|
||||
public static void Show(Git.Repository repo, string preferRemote = null) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new Fetch(repo, preferRemote));
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace SourceGit.UI {
|
|||
private async void Start(object sender, RoutedEventArgs e) {
|
||||
bool prune = chkPrune.IsChecked == true;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
if (chkFetchAll.IsChecked == true) {
|
||||
|
@ -71,7 +71,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SourceGit.UI {
|
|||
InitializeComponent();
|
||||
|
||||
// Move to center
|
||||
var parent = App.Launcher;
|
||||
var parent = App.Current.MainWindow;
|
||||
Left = parent.Left + (parent.Width - Width) * 0.5;
|
||||
Top = parent.Top + (parent.Height - Height) * 0.5;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace SourceGit.UI {
|
|||
txtBranchType.Content = "Hotfix :";
|
||||
break;
|
||||
default:
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Close();
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="branch"></param>
|
||||
public static void Show(Git.Repository repo, Git.Branch branch) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new GitFlowFinishBranch(repo, branch));
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Sure(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.FinishGitFlowBranch(branch));
|
||||
popup?.Close(true);
|
||||
|
@ -72,7 +72,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace SourceGit.UI {
|
|||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
public static void Show(Git.Repository repo) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new GitFlowSetup(repo));
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Sure(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
var master = txtMaster.Text;
|
||||
|
@ -56,7 +56,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace SourceGit.UI {
|
|||
nameValidator.Prefix = hotfixPrefix;
|
||||
break;
|
||||
default:
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Close();
|
||||
return;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="type"></param>
|
||||
public static void Show(Git.Repository repo, Git.Branch.Type type) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new GitFlowStartBranch(repo, type));
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace SourceGit.UI {
|
|||
txtName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||
if (Validation.GetHasError(txtName)) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.StartGitFlowBranch(type, SubName));
|
||||
popup?.Close(true);
|
||||
|
@ -88,7 +88,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -526,7 +526,7 @@ namespace SourceGit.UI {
|
|||
}
|
||||
|
||||
var dialog = new InteractiveRebase(Repo, commit);
|
||||
dialog.Owner = App.Launcher;
|
||||
dialog.Owner = App.Current.MainWindow;
|
||||
dialog.ShowDialog();
|
||||
} else {
|
||||
Rebase.Show(Repo, commit);
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace SourceGit.UI {
|
|||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public static void Show(string path) {
|
||||
var popup = App.Launcher.GetPopupManager(null);
|
||||
var popup = App.GetPopupManager(null);
|
||||
popup.Show(new Init(path));
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Sure(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(null);
|
||||
var popup = App.GetPopupManager(null);
|
||||
popup.Lock();
|
||||
|
||||
await Task.Run(() => {
|
||||
|
@ -59,7 +59,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(null).Close();
|
||||
App.GetPopupManager(null).Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ namespace SourceGit.UI {
|
|||
|
||||
Git.Repository.OnOpen = repo => {
|
||||
Dispatcher.Invoke(() => {
|
||||
foreach (var item in openedTabs.Items) {
|
||||
var opened = item as Tab;
|
||||
if (opened != null && opened.Repo != null && repo.Path == opened.Repo.Path) {
|
||||
for (int i = 1; i < openedTabs.Items.Count; i++) {
|
||||
var opened = openedTabs.Items[i] as Tab;
|
||||
if (opened.Repo.Path == repo.Path) {
|
||||
openedTabs.SelectedItem = opened;
|
||||
return;
|
||||
}
|
||||
|
@ -76,23 +76,6 @@ namespace SourceGit.UI {
|
|||
openedTabs.SelectedItem = Tabs[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get popup manager from given active page.
|
||||
/// </summary>
|
||||
/// <param name="repo"></param>
|
||||
/// <returns></returns>
|
||||
public PopupManager GetPopupManager(Git.Repository repo) {
|
||||
if (repo == null) return (Tabs[0].Page as Manager).popupManager;
|
||||
|
||||
foreach (var tab in Tabs) {
|
||||
if (tab.Repo != null && tab.Repo.Path == repo.Path) {
|
||||
return (tab.Page as Dashboard).popupManager;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#region LAYOUT_CONTENT
|
||||
/// <summary>
|
||||
/// Close repository tab.
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="source"></param>
|
||||
/// <param name="dest"></param>
|
||||
public static void Show(Git.Repository opened, string source, string dest) {
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(new Merge(opened, source, dest));
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="dest"></param>
|
||||
public static void StartDirectly(Git.Repository opened, string source, string dest) {
|
||||
var merge = new Merge(opened, source, dest);
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(merge);
|
||||
popup?.Lock();
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Start(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
var branch = sourceBranch.Content as string;
|
||||
|
@ -99,7 +99,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="opened">Opened repository</param>
|
||||
/// <param name="preferRemoteBranch">Prefered remote branch</param>
|
||||
public static void Show(Git.Repository opened, string preferRemoteBranch = null) {
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(new Pull(opened, preferRemoteBranch));
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ namespace SourceGit.UI {
|
|||
|
||||
if (remote == null || branch == null) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.Pull(remote, branch.Substring(branch.IndexOf('/')+1), msg => popup?.UpdateStatus(msg), rebase, autoStash));
|
||||
popup?.Close(true);
|
||||
|
@ -89,7 +89,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="prefer"></param>
|
||||
public static void Show(Git.Repository repo, Git.Branch prefer = null) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new Push(repo, prefer));
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace SourceGit.UI {
|
|||
}
|
||||
|
||||
var push = new Push(repo, current);
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(push);
|
||||
popup?.Lock();
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace SourceGit.UI {
|
|||
remoteBranch = remoteBranch.Substring(0, remoteBranch.Length - 6);
|
||||
}
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.Push(remote, localBranch.Name, remoteBranch, msg => popup?.UpdateStatus(msg), tags, track, force));
|
||||
popup?.Close(true);
|
||||
|
@ -110,7 +110,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="tag"></param>
|
||||
public static void Show(Git.Repository repo, Git.Tag tag) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new PushTag(repo, tag));
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace SourceGit.UI {
|
|||
var remote = combRemotes.SelectedItem as Git.Remote;
|
||||
if (remote == null) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => Git.Tag.Push(repo, tag.Name, remote.Name));
|
||||
popup?.Close(true);
|
||||
|
@ -57,7 +57,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace SourceGit.UI {
|
|||
dialog.type.Data = dialog.FindResource("Icon.Branch") as Geometry;
|
||||
dialog.desc.Content = branch.Name;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(dialog);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ namespace SourceGit.UI {
|
|||
dialog.type.Data = dialog.FindResource("Icon.Commit") as Geometry;
|
||||
dialog.desc.Content = $"{commit.ShortSHA} {commit.Subject}";
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(opened);
|
||||
var popup = App.GetPopupManager(opened);
|
||||
popup?.Show(dialog);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Start(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
var autoStash = chkAutoStash.IsChecked == true;
|
||||
|
@ -77,7 +77,7 @@ namespace SourceGit.UI {
|
|||
}
|
||||
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="opened"></param>
|
||||
/// <param name="editing"></param>
|
||||
public static void Show(Git.Repository opened, Git.Remote editing = null) {
|
||||
App.Launcher.GetPopupManager(opened)?.Show(new Remote(opened, editing));
|
||||
App.GetPopupManager(opened)?.Show(new Remote(opened, editing));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -59,7 +59,7 @@ namespace SourceGit.UI {
|
|||
txtUrl.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||
if (Validation.GetHasError(txtUrl)) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
|
||||
await Task.Run(() => {
|
||||
|
@ -79,7 +79,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="opened"></param>
|
||||
/// <param name="branch"></param>
|
||||
public static void Show(Git.Repository opened, Git.Branch branch) {
|
||||
App.Launcher.GetPopupManager(opened)?.Show(new RenameBranch(opened, branch));
|
||||
App.GetPopupManager(opened)?.Show(new RenameBranch(opened, branch));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -50,7 +50,7 @@ namespace SourceGit.UI {
|
|||
txtNewName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||
if (Validation.GetHasError(txtNewName)) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => branch.Rename(repo, NewName));
|
||||
popup?.Close(true);
|
||||
|
@ -62,7 +62,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace SourceGit.UI {
|
|||
var current = repo.CurrentBranch();
|
||||
if (current == null) return;
|
||||
|
||||
App.Launcher.GetPopupManager(repo)?.Show(new Reset(repo, current, commit));
|
||||
App.GetPopupManager(repo)?.Show(new Reset(repo, current, commit));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -71,7 +71,7 @@ namespace SourceGit.UI {
|
|||
var mode = combMode.SelectedItem as Mode;
|
||||
if (mode == null) return;
|
||||
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.Reset(revision, mode.Arg));
|
||||
popup?.Close(true);
|
||||
|
@ -83,7 +83,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo"></param>
|
||||
/// <param name="commit"></param>
|
||||
public static void Show(Git.Repository repo, Git.Commit commit) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new Revert(repo, commit));
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="e"></param>
|
||||
private async void Sure(object sender, RoutedEventArgs e) {
|
||||
bool autoCommit = chkCommit.IsChecked == true;
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Lock();
|
||||
await Task.Run(() => repo.Revert(sha, autoCommit));
|
||||
popup?.Close(true);
|
||||
|
@ -53,7 +53,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="repo">Opened repository</param>
|
||||
/// <param name="files">Special files to stash</param>
|
||||
public static void Show(Git.Repository repo, List<string> files) {
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
popup?.Show(new Stash(repo, files));
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace SourceGit.UI {
|
|||
string message = txtName.Text;
|
||||
|
||||
Git.Stash.Push(repo, includeUntracked, message, files);
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -51,7 +51,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Cancel(object sender, RoutedEventArgs e) {
|
||||
App.Launcher.GetPopupManager(repo)?.Close();
|
||||
App.GetPopupManager(repo)?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace SourceGit.UI {
|
|||
/// <param name="job"></param>
|
||||
public static void Show(Git.Repository repo, Action job) {
|
||||
var dialog = new Waiting();
|
||||
var popup = App.Launcher.GetPopupManager(repo);
|
||||
var popup = App.GetPopupManager(repo);
|
||||
|
||||
popup?.Show(dialog);
|
||||
popup?.Lock();
|
||||
|
|
Loading…
Reference in a new issue