diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index fd0bc15e..91563527 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -429,85 +429,6 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - + - + diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index 57cbcc7f..cd7f9c4a 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -27,14 +27,10 @@ Data="{StaticResource Icons.Hotkeys}" IsVisible="{OnPlatform True, macOS=False}"/> - - - + - + diff --git a/src/Views/Hotkeys.axaml.cs b/src/Views/Hotkeys.axaml.cs index 3e233009..2a21fef9 100644 --- a/src/Views/Hotkeys.axaml.cs +++ b/src/Views/Hotkeys.axaml.cs @@ -1,5 +1,4 @@ using Avalonia.Input; -using Avalonia.Interactivity; namespace SourceGit.Views { @@ -14,10 +13,5 @@ namespace SourceGit.Views { BeginMoveDrag(e); } - - private void CloseWindow(object _1, RoutedEventArgs _2) - { - Close(); - } } } diff --git a/src/Views/InteractiveRebase.axaml b/src/Views/InteractiveRebase.axaml index d33b29f8..a8f9d360 100644 --- a/src/Views/InteractiveRebase.axaml +++ b/src/Views/InteractiveRebase.axaml @@ -28,14 +28,10 @@ Data="{StaticResource Icons.InteractiveRebase}" IsVisible="{OnPlatform True, macOS=False}"/> - - - + - + diff --git a/src/Views/LFSLocks.axaml b/src/Views/LFSLocks.axaml index ac047f7e..53392043 100644 --- a/src/Views/LFSLocks.axaml +++ b/src/Views/LFSLocks.axaml @@ -27,14 +27,10 @@ Data="{StaticResource Icons.Lock}" IsVisible="{OnPlatform True, macOS=False}"/> - - - + - + diff --git a/src/Views/LFSLocks.axaml.cs b/src/Views/LFSLocks.axaml.cs index b62bc327..ee4b6ff1 100644 --- a/src/Views/LFSLocks.axaml.cs +++ b/src/Views/LFSLocks.axaml.cs @@ -16,11 +16,6 @@ namespace SourceGit.Views BeginMoveDrag(e); } - private void CloseWindow(object _1, RoutedEventArgs _2) - { - Close(); - } - private void OnUnlockButtonClicked(object sender, RoutedEventArgs e) { if (DataContext is ViewModels.LFSLocks vm && sender is Button button) diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index 983cce28..67e771ff 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -29,14 +29,10 @@ Margin="10,0,0,0" IsVisible="{OnPlatform True, macOS=False}"/> - - - + - + diff --git a/src/Views/Preference.axaml.cs b/src/Views/Preference.axaml.cs index 20e34209..2621bcaf 100644 --- a/src/Views/Preference.axaml.cs +++ b/src/Views/Preference.axaml.cs @@ -125,12 +125,7 @@ namespace SourceGit.Views } } - private void BeginMoveWindow(object _, PointerPressedEventArgs e) - { - BeginMoveDrag(e); - } - - private void CloseWindow(object _1, RoutedEventArgs _2) + protected override void OnClosing(WindowClosingEventArgs e) { var config = new Commands.Config(null).ListAll(); SetIfChanged(config, "user.name", DefaultUser); @@ -143,8 +138,13 @@ namespace SourceGit.Views if (!GPGFormat.Value.Equals("ssh", StringComparison.Ordinal)) SetIfChanged(config, $"gpg.{GPGFormat.Value}.program", GPGExecutableFile); + + base.OnClosing(e); + } - Close(); + private void BeginMoveWindow(object _, PointerPressedEventArgs e) + { + BeginMoveDrag(e); } private async void SelectThemeOverrideFile(object _, RoutedEventArgs e) diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml index a6a8e5c5..44ffe4b6 100644 --- a/src/Views/RepositoryConfigure.axaml +++ b/src/Views/RepositoryConfigure.axaml @@ -27,15 +27,11 @@ Data="{StaticResource Icons.Settings}" Margin="10,0,0,0" IsVisible="{OnPlatform True, macOS=False}"/> - - - - + + - + diff --git a/src/Views/RepositoryConfigure.axaml.cs b/src/Views/RepositoryConfigure.axaml.cs index b309453d..7e559cc2 100644 --- a/src/Views/RepositoryConfigure.axaml.cs +++ b/src/Views/RepositoryConfigure.axaml.cs @@ -1,5 +1,5 @@ +using Avalonia.Controls; using Avalonia.Input; -using Avalonia.Interactivity; namespace SourceGit.Views { @@ -10,15 +10,15 @@ namespace SourceGit.Views InitializeComponent(); } + protected override void OnClosing(WindowClosingEventArgs e) + { + (DataContext as ViewModels.RepositoryConfigure)?.Save(); + base.OnClosing(e); + } + private void BeginMoveWindow(object _, PointerPressedEventArgs e) { BeginMoveDrag(e); } - - private void CloseWindow(object _1, RoutedEventArgs _2) - { - (DataContext as ViewModels.RepositoryConfigure)?.Save(); - Close(); - } } } diff --git a/src/Views/SelfUpdate.axaml b/src/Views/SelfUpdate.axaml index fc4dcedf..0015a957 100644 --- a/src/Views/SelfUpdate.axaml +++ b/src/Views/SelfUpdate.axaml @@ -29,14 +29,10 @@ Data="{StaticResource Icons.SoftwareUpdate}" IsVisible="{OnPlatform True, macOS=False}"/> - - - + - + diff --git a/src/Views/StandaloneCommitMessageEditor.axaml b/src/Views/StandaloneCommitMessageEditor.axaml index 319f107f..f59d3e84 100644 --- a/src/Views/StandaloneCommitMessageEditor.axaml +++ b/src/Views/StandaloneCommitMessageEditor.axaml @@ -26,14 +26,10 @@ Data="{StaticResource Icons.Edit}" IsVisible="{OnPlatform True, macOS=False}"/> - - - + - + diff --git a/src/Views/StandaloneCommitMessageEditor.axaml.cs b/src/Views/StandaloneCommitMessageEditor.axaml.cs index dd4c0fcf..08b0d6f4 100644 --- a/src/Views/StandaloneCommitMessageEditor.axaml.cs +++ b/src/Views/StandaloneCommitMessageEditor.axaml.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using Avalonia.Input; @@ -33,22 +34,25 @@ namespace SourceGit.Views } } + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + App.Quit(_exitCode); + } + private void BeginMoveWindow(object _, PointerPressedEventArgs e) { BeginMoveDrag(e); } - private void CloseWindow(object _1, RoutedEventArgs _2) - { - App.Quit(-1); - } - private void SaveAndClose(object _1, RoutedEventArgs _2) { File.WriteAllText(_file, Editor.Text); - App.Quit(0); + _exitCode = 0; + Close(); } private readonly string _file; + private int _exitCode = -1; } } diff --git a/src/Views/Statistics.axaml b/src/Views/Statistics.axaml index 05024372..4efb1e9d 100644 --- a/src/Views/Statistics.axaml +++ b/src/Views/Statistics.axaml @@ -27,14 +27,10 @@ Data="{StaticResource Icons.Statistics}" IsVisible="{OnPlatform True, macOS=False}"/> - - - + - + diff --git a/src/Views/Statistics.axaml.cs b/src/Views/Statistics.axaml.cs index 4f68ccab..5aceaceb 100644 --- a/src/Views/Statistics.axaml.cs +++ b/src/Views/Statistics.axaml.cs @@ -5,7 +5,6 @@ using System.Globalization; using Avalonia; using Avalonia.Controls; using Avalonia.Input; -using Avalonia.Interactivity; using Avalonia.Media; namespace SourceGit.Views @@ -227,10 +226,5 @@ namespace SourceGit.Views { BeginMoveDrag(e); } - - private void CloseWindow(object _1, RoutedEventArgs _2) - { - Close(); - } } }