From a5b99c25ed45d94a3e3bb4b1b03fb9f12aac4d58 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 7 Feb 2026 14:58:35 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=96=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettingsViews/UpdateCenterPanel.xaml.cs | 33 +++++++++++++++---- .../Windows/SettingsViews/SettingsWindow.xaml | 4 ++- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs index d21f949d..86c7df3e 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs @@ -32,7 +32,6 @@ namespace Ink_Canvas.Windows.SettingsViews LoadSettings(); SwitchTab("Update"); CheckUpdateStatus(); - LoadUpdateLog(MainWindow.Settings?.Startup?.UpdateChannel ?? UpdateChannel.Release); ApplyTheme(); } } @@ -283,7 +282,7 @@ namespace Ink_Canvas.Windows.SettingsViews } else { - LoadUpdateLog(updateChannel); + LoadUpdateLogAsFallback(updateChannel); } if (manualCheck) @@ -308,7 +307,7 @@ namespace Ink_Canvas.Windows.SettingsViews }); } - private async void LoadUpdateLog(UpdateChannel channel) + private async Task LoadUpdateLogAsFallback(UpdateChannel channel) { try { @@ -329,6 +328,28 @@ namespace Ink_Canvas.Windows.SettingsViews } } + private async void LoadUpdateLogWithPriority(UpdateChannel channel) + { + try + { + var (remoteVersion, lineGroup, releaseNotes) = await AutoUpdateHelper.CheckForUpdates(channel, false, false); + + if (!string.IsNullOrEmpty(releaseNotes)) + { + UpdateLogViewer.Markdown = releaseNotes; + } + else + { + await LoadUpdateLogAsFallback(channel); + } + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"加载更新日志失败: {ex.Message}"); + await LoadUpdateLogAsFallback(channel); + } + } + private async void LoadHistoryVersions() { try @@ -447,7 +468,7 @@ namespace Ink_Canvas.Windows.SettingsViews new System.Windows.Controls.RadioButton { Tag = "Release" }, e); UpdateUpdateChannelButtons(UpdateChannel.Release); LoadHistoryVersions(); - LoadUpdateLog(UpdateChannel.Release); + LoadUpdateLogWithPriority(UpdateChannel.Release); break; case "UpdateChannel_Preview": @@ -459,7 +480,7 @@ namespace Ink_Canvas.Windows.SettingsViews new System.Windows.Controls.RadioButton { Tag = "Preview" }, e); UpdateUpdateChannelButtons(UpdateChannel.Preview); LoadHistoryVersions(); - LoadUpdateLog(UpdateChannel.Preview); + LoadUpdateLogWithPriority(UpdateChannel.Preview); break; case "UpdateChannel_Beta": @@ -471,7 +492,7 @@ namespace Ink_Canvas.Windows.SettingsViews new System.Windows.Controls.RadioButton { Tag = "Beta" }, e); UpdateUpdateChannelButtons(UpdateChannel.Beta); LoadHistoryVersions(); - LoadUpdateLog(UpdateChannel.Beta); + LoadUpdateLogWithPriority(UpdateChannel.Beta); break; } } diff --git a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml index a86fc929..e4aa8a92 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml +++ b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml @@ -199,7 +199,9 @@ - + + +