From ca8d3c9f141ebe841ca689d97c899ea8358cd480 Mon Sep 17 00:00:00 2001 From: rferraton <16419423+rferraton@users.noreply.github.com> Date: Thu, 28 May 2026 00:09:37 +0200 Subject: [PATCH 1/4] add settings working wave 1 --- .../Controls/QuerySessionControl.Format.cs | 18 +- .../Controls/QuerySessionControl.axaml | 4 - .../Controls/QueryStoreGridControl.axaml.cs | 29 +- .../QueryStoreHistoryControl.axaml.cs | 9 +- .../QueryStoreOverviewControl.axaml.cs | 31 +- .../Controls/TimeRangeSlicerControl.axaml.cs | 9 +- .../Dialogs/QueryStoreHistoryWindow.axaml.cs | 11 +- .../Dialogs/SettingsWindow.axaml | 69 ++ .../Dialogs/SettingsWindow.axaml.cs | 682 ++++++++++++++++++ src/PlanViewer.App/MainWindow.axaml | 1 + src/PlanViewer.App/MainWindow.axaml.cs | 23 + .../Services/AppSettingsService.cs | 137 +++- .../Services/SqlFormatSettingsService.cs | 33 +- 13 files changed, 976 insertions(+), 80 deletions(-) create mode 100644 src/PlanViewer.App/Dialogs/SettingsWindow.axaml create mode 100644 src/PlanViewer.App/Dialogs/SettingsWindow.axaml.cs diff --git a/src/PlanViewer.App/Controls/QuerySessionControl.Format.cs b/src/PlanViewer.App/Controls/QuerySessionControl.Format.cs index 9ead789..5ab4fa8 100644 --- a/src/PlanViewer.App/Controls/QuerySessionControl.Format.cs +++ b/src/PlanViewer.App/Controls/QuerySessionControl.Format.cs @@ -86,9 +86,7 @@ private async void Format_Click(object? sender, RoutedEventArgs e) try { - var settings = SqlFormatSettingsService.Load(out var loadError); - if (loadError != null) - SetStatus("Warning: using default format settings (load failed)"); + var settings = AppSettingsService.Load().FormatOptions ?? new SqlFormatSettings(); var (formatted, errors) = await Task.Run(() => SqlFormattingService.Format(sql, settings)); @@ -147,13 +145,7 @@ private async void Format_Click(object? sender, RoutedEventArgs e) } finally { - FormatButton.IsEnabled = true; - } - } - - private void FormatOptions_Click(object? sender, RoutedEventArgs e) - { - var dialog = new Dialogs.FormatOptionsWindow(); - dialog.ShowDialog(GetParentWindow()); - } -} + FormatButton.IsEnabled = true; + } + } + } diff --git a/src/PlanViewer.App/Controls/QuerySessionControl.axaml b/src/PlanViewer.App/Controls/QuerySessionControl.axaml index a9aefad..f651f35 100644 --- a/src/PlanViewer.App/Controls/QuerySessionControl.axaml +++ b/src/PlanViewer.App/Controls/QuerySessionControl.axaml @@ -92,10 +92,6 @@ Height="28" Padding="10,0" FontSize="12" Theme="{StaticResource AppButton}" ToolTip.Tip="Format the SQL query"/> -