diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 659df263..05858d14 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -427,13 +427,6 @@ namespace SourceGit.ViewModels PopupHost.ShowAndStartPopup(new Cleanup(this)); } - public void OpenConfigure() - { - if (!PopupHost.CanCreatePopup()) - return; - PopupHost.ShowPopup(new RepositoryConfigure(this)); - } - public void ClearHistoriesFilter() { _settings.Filters.Clear(); diff --git a/src/ViewModels/RepositoryConfigure.cs b/src/ViewModels/RepositoryConfigure.cs index 6472e733..bad30749 100644 --- a/src/ViewModels/RepositoryConfigure.cs +++ b/src/ViewModels/RepositoryConfigure.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; -using System.Threading.Tasks; +using CommunityToolkit.Mvvm.ComponentModel; namespace SourceGit.ViewModels { - public class RepositoryConfigure : Popup + public class RepositoryConfigure : ObservableObject { public string UserName { @@ -58,11 +58,9 @@ namespace SourceGit.ViewModels GPGUserSigningKey = signingKey; if (_cached.TryGetValue("http.proxy", out var proxy)) HttpProxy = proxy; - - View = new Views.RepositoryConfigure() { DataContext = this }; } - public override Task Sure() + public void Save() { SetIfChanged("user.name", UserName); SetIfChanged("user.email", UserEmail); @@ -70,7 +68,6 @@ namespace SourceGit.ViewModels SetIfChanged("tag.gpgsign", GPGTagSigningEnabled ? "true" : "false"); SetIfChanged("user.signingkey", GPGUserSigningKey); SetIfChanged("http.proxy", HttpProxy); - return null; } private void SetIfChanged(string key, string value) diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml index aa7501a2..38f6dc87 100644 --- a/src/Views/RepositoryConfigure.axaml +++ b/src/Views/RepositoryConfigure.axaml @@ -1,18 +1,53 @@ - - - + + + + + - + + + + + + + + + + + + + - - + + + + + + @@ -72,10 +76,6 @@ - - diff --git a/src/Views/RepositoryToolbar.axaml.cs b/src/Views/RepositoryToolbar.axaml.cs index 40f90291..57fed44b 100644 --- a/src/Views/RepositoryToolbar.axaml.cs +++ b/src/Views/RepositoryToolbar.axaml.cs @@ -20,6 +20,26 @@ namespace SourceGit.Views } } + private async void OpenStatistics(object _, RoutedEventArgs e) + { + if (DataContext is ViewModels.Repository repo && TopLevel.GetTopLevel(this) is Window owner) + { + var dialog = new Statistics() { DataContext = new ViewModels.Statistics(repo.FullPath) }; + await dialog.ShowDialog(owner); + e.Handled = true; + } + } + + private async void OpenConfigure(object sender, RoutedEventArgs e) + { + if (DataContext is ViewModels.Repository repo && TopLevel.GetTopLevel(this) is Window owner) + { + var dialog = new RepositoryConfigure() { DataContext = new ViewModels.RepositoryConfigure(repo) }; + await dialog.ShowDialog(owner); + e.Handled = true; + } + } + private void OpenGitFlowMenu(object sender, RoutedEventArgs e) { if (DataContext is ViewModels.Repository repo) @@ -41,16 +61,6 @@ namespace SourceGit.Views e.Handled = true; } - - private async void OpenStatistics(object _, RoutedEventArgs e) - { - if (DataContext is ViewModels.Repository repo && TopLevel.GetTopLevel(this) is Window owner) - { - var dialog = new Statistics() { DataContext = new ViewModels.Statistics(repo.FullPath) }; - await dialog.ShowDialog(owner); - e.Handled = true; - } - } } }