From e66c8a504eadb0ff665d90bfa47793dcda533d1b Mon Sep 17 00:00:00 2001 From: Davide Giacometti Date: Sat, 8 Mar 2025 12:52:25 +0100 Subject: [PATCH] minor changes and retry button --- .../SettingsXAML/OOBE/Views/OobeWhatsNew.xaml | 31 +++++++++++++++++-- .../OOBE/Views/OobeWhatsNew.xaml.cs | 25 ++++++++++----- .../Settings.UI/Strings/en-us/Resources.resw | 8 ++++- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml index fcae79fd27fa..8302ebee3a48 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml @@ -14,6 +14,7 @@ + @@ -85,7 +86,19 @@ VerticalAlignment="Top" IsClosable="False" IsTabStop="False" - Severity="Error" /> + Severity="Error"> + + + + + Severity="Warning"> + + + + - + GetReleaseNotesMarkdown() { @@ -126,11 +127,19 @@ private static async Task GetReleaseNotesMarkdown() private async Task Reload() { + if (_loadingReleaseNotes) + { + return; + } + try { + _loadingReleaseNotes = true; + ReleaseNotesMarkdown.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed; + LoadingProgressRing.Visibility = Microsoft.UI.Xaml.Visibility.Visible; string releaseNotesMarkdown = await GetReleaseNotesMarkdown(); - SetInfoBar(ProxyWarningInfoBar, false); - SetInfoBar(ErrorInfoBar, false); + ProxyWarningInfoBar.IsOpen = false; + ErrorInfoBar.IsOpen = false; ReleaseNotesMarkdown.Text = releaseNotesMarkdown; ReleaseNotesMarkdown.Visibility = Microsoft.UI.Xaml.Visibility.Visible; @@ -141,21 +150,22 @@ private async Task Reload() Logger.LogError("Exception when loading the release notes", httpEx); if (httpEx.Message.Contains("407", StringComparison.CurrentCulture)) { - SetInfoBar(ProxyWarningInfoBar, true); + ProxyWarningInfoBar.IsOpen = true; } else { - SetInfoBar(ErrorInfoBar, true); + ErrorInfoBar.IsOpen = true; } } catch (Exception ex) { Logger.LogError("Exception when loading the release notes", ex); - SetInfoBar(ErrorInfoBar, true); + ErrorInfoBar.IsOpen = true; } finally { LoadingProgressRing.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed; + _loadingReleaseNotes = false; } } @@ -247,10 +257,9 @@ private void DataDiagnostics_OpenSettings_Click(Microsoft.UI.Xaml.Documents.Hype Common.UI.SettingsDeepLink.OpenSettings(Common.UI.SettingsDeepLink.SettingsWindow.Overview, true); } - private void SetInfoBar(InfoBar infoBar, bool open) + private async void LoadReleaseNotes_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { - infoBar.IsOpen = open; - infoBar.IsTabStop = open; + await Reload(); } } } diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index f60f1f091024..d086a682cf79 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -4895,6 +4895,12 @@ To record a specific window, enter the hotkey with the Alt key in the opposite m NEW - Must be all caps + Must be all caps + + + Retry + + + Retry \ No newline at end of file