diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs
index 38cd537e..28611448 100644
--- a/Ink Canvas/MainWindow.xaml.cs
+++ b/Ink Canvas/MainWindow.xaml.cs
@@ -970,6 +970,24 @@ namespace Ink_Canvas
private async void AutoUpdate()
{
+ if (!string.IsNullOrEmpty(Settings.Startup.AutoUpdatePauseUntilDate))
+ {
+ if (DateTime.TryParse(Settings.Startup.AutoUpdatePauseUntilDate, out DateTime pauseUntilDate))
+ {
+ if (DateTime.Now < pauseUntilDate)
+ {
+ LogHelper.WriteLogToFile($"AutoUpdate | 自动更新已暂停,直到 {pauseUntilDate:yyyy-MM-dd}");
+ return;
+ }
+ else
+ {
+ LogHelper.WriteLogToFile($"AutoUpdate | 暂停期已过,恢复自动更新检查");
+ Settings.Startup.AutoUpdatePauseUntilDate = "";
+ SaveSettingsToFile();
+ }
+ }
+ }
+
// 清除之前的更新状态,确保使用新通道重新检查
AvailableLatestVersion = null;
AvailableLatestLineGroup = null;
diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs
index 3ef66dfe..15486708 100644
--- a/Ink Canvas/Resources/Settings.cs
+++ b/Ink Canvas/Resources/Settings.cs
@@ -157,6 +157,8 @@ namespace Ink_Canvas
public UpdateChannel UpdateChannel { get; set; } = UpdateChannel.Release;
[JsonProperty("skippedVersion")]
public string SkippedVersion { get; set; } = "";
+ [JsonProperty("autoUpdatePauseUntilDate")]
+ public string AutoUpdatePauseUntilDate { get; set; } = "";
[JsonProperty("isEnableNibMode")]
public bool IsEnableNibMode { get; set; }
[JsonProperty("isFoldAtStartup")]
diff --git a/Ink Canvas/Windows/HistoryRollbackWindow.xaml b/Ink Canvas/Windows/HistoryRollbackWindow.xaml
index e130e348..f23a27f2 100644
--- a/Ink Canvas/Windows/HistoryRollbackWindow.xaml
+++ b/Ink Canvas/Windows/HistoryRollbackWindow.xaml
@@ -20,103 +20,105 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs b/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs
index 34d64f47..221febd1 100644
--- a/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs
+++ b/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs
@@ -1,5 +1,6 @@
using Ink_Canvas.Helpers;
using iNKORE.UI.WPF.Modern;
+using iNKORE.UI.WPF.Modern.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -201,7 +202,83 @@ namespace Ink_Canvas
private async void RollbackButton_Click(object sender, RoutedEventArgs e)
{
if (selectedItem == null) return;
- LogHelper.WriteLogToFile($"HistoryRollback | 用户点击回滚,目标版本: {selectedItem.Version}");
+
+ var dialog = new ContentDialog
+ {
+ Title = "暂停自动更新",
+ PrimaryButtonText = "确定",
+ SecondaryButtonText = "取消"
+ };
+
+ var panel = new iNKORE.UI.WPF.Modern.Controls.SimpleStackPanel
+ {
+ Spacing = 16,
+ Margin = new Thickness(0, 10, 0, 0)
+ };
+
+ var textBlock = new TextBlock
+ {
+ Text = "请选择在回滚后多久不再接收自动更新:",
+ FontSize = 14,
+ Foreground = (Brush)Resources["TextPrimaryBrush"]
+ };
+
+ var daysComboBox = new ComboBox
+ {
+ Width = 200,
+ Height = 36,
+ HorizontalAlignment = HorizontalAlignment.Left
+ };
+
+ for (int i = 0; i <= 7; i++)
+ {
+ daysComboBox.Items.Add(new ComboBoxItem
+ {
+ Content = $"{i} 天",
+ Tag = i
+ });
+ }
+
+ daysComboBox.SelectedIndex = 0;
+
+ panel.Children.Add(textBlock);
+ panel.Children.Add(daysComboBox);
+ dialog.Content = panel;
+
+ var dialogResult = await dialog.ShowAsync();
+
+ if (dialogResult == ContentDialogResult.Primary)
+ {
+ int days = 1;
+ if (daysComboBox.SelectedItem is ComboBoxItem selectedItemCombo &&
+ selectedItemCombo.Tag != null &&
+ int.TryParse(selectedItemCombo.Tag.ToString(), out int selectedDays))
+ {
+ days = selectedDays;
+ }
+
+ if (days == 0)
+ {
+ MainWindow.Settings.Startup.AutoUpdatePauseUntilDate = "";
+ }
+ else
+ {
+ DateTime pauseUntilDate = DateTime.Now.AddDays(days);
+ MainWindow.Settings.Startup.AutoUpdatePauseUntilDate = pauseUntilDate.ToString("yyyy-MM-dd");
+ LogHelper.WriteLogToFile($"HistoryRollback | 用户选择暂停自动更新 {days} 天,截止日期: {pauseUntilDate:yyyy-MM-dd}");
+ }
+
+ MainWindow.SaveSettingsToFile();
+
+ LogHelper.WriteLogToFile($"HistoryRollback | 用户选择暂停自动更新 {days} 天");
+ }
+ else
+ {
+ LogHelper.WriteLogToFile("HistoryRollback | 用户取消了回滚操作");
+ return;
+ }
+
+ LogHelper.WriteLogToFile($"HistoryRollback | 用户确认回滚,目标版本: {selectedItem.Version}");
RollbackButton.IsEnabled = false;
VersionComboBox.IsEnabled = false;
DownloadProgressPanel.Visibility = Visibility.Visible;