diff --git a/src/Languages/lang_en.json b/src/Languages/lang_en.json index 4114be383e..70d044f631 100644 --- a/src/Languages/lang_en.json +++ b/src/Languages/lang_en.json @@ -84,6 +84,7 @@ "Show UniGetUI": "Show UniGetUI", "Quit": "Quit", "Are you sure?": "Are you sure?", + "Do you really want to reset UniGetUI to its default settings? This action cannot be undone.": "Do you really want to reset UniGetUI to its default settings? This action cannot be undone.", "Do you really want to uninstall {0}?": "Do you really want to uninstall {0}?", "Do you really want to uninstall the following {0} packages?": "Do you really want to uninstall the following {0} packages?", "No": "No", diff --git a/src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/GeneralViewModel.cs b/src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/GeneralViewModel.cs index c33dad3027..58250b5b09 100644 --- a/src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/GeneralViewModel.cs +++ b/src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/GeneralViewModel.cs @@ -69,8 +69,13 @@ private static async Task ExportSettings(Visual? visual) } [RelayCommand] - private void ResetSettings(Visual? _) + private async Task ResetSettings(Visual? visual) { + if (visual is null || TopLevel.GetTopLevel(visual) is not Window owner) return; + var dialog = new ResetSettingsDialog(); + await dialog.ShowDialog(owner); + if (!dialog.Confirmed) return; + try { CoreSettings.ResetSettings(); } catch (Exception ex) { Logger.Error(ex); } AccessibilityAnnouncementService.Announce( diff --git a/src/UniGetUI.Avalonia/Views/DialogPages/ResetSettingsDialog.axaml b/src/UniGetUI.Avalonia/Views/DialogPages/ResetSettingsDialog.axaml new file mode 100644 index 0000000000..6b83d6531c --- /dev/null +++ b/src/UniGetUI.Avalonia/Views/DialogPages/ResetSettingsDialog.axaml @@ -0,0 +1,47 @@ + + + + + + + + + +