From 02496214ea2cabbd0037bc83f3e9e03125311222 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sat, 7 Jun 2025 00:07:44 +0800
Subject: [PATCH] Add progress ring
---
Flow.Launcher/ReleaseNotesWindow.xaml | 23 ++++++++++++++++
Flow.Launcher/ReleaseNotesWindow.xaml.cs | 34 +++++++++++++++++++++---
2 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml b/Flow.Launcher/ReleaseNotesWindow.xaml
index 7b2e5f7e7..f70fa6f5c 100644
--- a/Flow.Launcher/ReleaseNotesWindow.xaml
+++ b/Flow.Launcher/ReleaseNotesWindow.xaml
@@ -163,6 +163,29 @@
VerticalAlignment="Stretch"
ClickAction="SafetyDisplayWithRelativePath"
Loaded="MarkdownViewer_Loaded" />
+
+
+
+
+
+
diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml.cs b/Flow.Launcher/ReleaseNotesWindow.xaml.cs
index 4f0c1a9ce..8881f3fb6 100644
--- a/Flow.Launcher/ReleaseNotesWindow.xaml.cs
+++ b/Flow.Launcher/ReleaseNotesWindow.xaml.cs
@@ -81,7 +81,7 @@ namespace Flow.Launcher
private static async Task GetReleaseNotesMarkdownAsync()
{
var releaseNotesJSON = await Http.GetStringAsync("https://api.github.com/repos/Flow-Launcher/Flow.Launcher/releases");
-
+
if (string.IsNullOrEmpty(releaseNotesJSON))
{
return string.Empty;
@@ -150,11 +150,37 @@ namespace Flow.Launcher
#endregion
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "")]
- private async void MarkdownViewer_Loaded(object sender, RoutedEventArgs e)
+ private void MarkdownViewer_Loaded(object sender, RoutedEventArgs e)
{
MarkdownViewer.MarkdownStyle = MarkdownStyle.GithubLike;
- MarkdownViewer.Markdown = await GetReleaseNotesMarkdownAsync();
+ RefreshMarkdownViewer();
+ }
+
+ private void RefreshButton_Click(object sender, RoutedEventArgs e)
+ {
+ RefreshButton.Visibility = Visibility.Collapsed;
+ RefreshProgressRing.Visibility = Visibility.Visible;
+ RefreshMarkdownViewer();
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "")]
+ private async void RefreshMarkdownViewer()
+ {
+ var output = await GetReleaseNotesMarkdownAsync().ConfigureAwait(false);
+
+ Application.Current.Dispatcher.Invoke(() =>
+ {
+ RefreshProgressRing.Visibility = Visibility.Collapsed;
+ if (string.IsNullOrEmpty(output))
+ {
+ RefreshButton.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ RefreshButton.Visibility = Visibility.Collapsed;
+ MarkdownViewer.Markdown = output;
+ }
+ });
}
}
}