add:兼容性变更提示

This commit is contained in:
2026-04-18 17:23:21 +08:00
parent 1640238728
commit 51dcc374ce
5 changed files with 170 additions and 2 deletions
+58 -1
View File
@@ -617,6 +617,18 @@ namespace Ink_Canvas
private void ToggleSwitchIsAutoUpdate_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
if (ToggleSwitchIsAutoUpdate.IsOn && Settings?.Startup?.HasConfirmedNetCompatibilityChange != true)
{
ToggleSwitchIsAutoUpdate.IsOn = false;
MessageBox.Show(
"此版本为最后一个NET472版本,您需要手动确认才能继续接受自动更新。",
"兼容性变更",
MessageBoxButton.OK,
MessageBoxImage.Warning);
return;
}
Settings.Startup.IsAutoUpdate = ToggleSwitchIsAutoUpdate.IsOn;
// 自动更新关闭时隐藏静默更新选项
@@ -651,6 +663,18 @@ namespace Ink_Canvas
private void ToggleSwitchIsAutoUpdateWithSilence_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
if (ToggleSwitchIsAutoUpdateWithSilence.IsOn && Settings?.Startup?.HasConfirmedNetCompatibilityChange != true)
{
ToggleSwitchIsAutoUpdateWithSilence.IsOn = false;
MessageBox.Show(
"此版本为最后一个NET472版本,您需要手动确认才能继续接受自动更新。",
"兼容性变更",
MessageBoxButton.OK,
MessageBoxImage.Warning);
return;
}
Settings.Startup.IsAutoUpdateWithSilence = ToggleSwitchIsAutoUpdateWithSilence.IsOn;
// 静默更新的时间设置区域只在静默更新开启时显示
@@ -5303,7 +5327,7 @@ namespace Ink_Canvas
SaveSettingsToFile();
// 如果启用了自动更新,立即执行完整的检查更新操作
if (Settings.Startup.IsAutoUpdate)
if (Settings.Startup.IsAutoUpdate && Settings.Startup.HasConfirmedNetCompatibilityChange)
{
LogHelper.WriteLogToFile($"AutoUpdate | Channel changed to {newChannel}, performing immediate update check");
ResetUpdateCheckRetry();
@@ -5332,6 +5356,39 @@ namespace Ink_Canvas
}
}
private void ConfirmNetCompatibilityChangeButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (Settings?.Startup == null)
{
Settings.Startup = new Startup();
}
Settings.Startup.HasConfirmedNetCompatibilityChange = true;
SaveSettingsToFile();
if (Net472CompatibilityWarningPanel != null)
{
Net472CompatibilityWarningPanel.Visibility = Visibility.Collapsed;
}
if (ToggleSwitchIsAutoUpdate != null)
{
ToggleSwitchIsAutoUpdate.IsEnabled = true;
}
if (ToggleSwitchIsAutoUpdateWithSilence != null)
{
ToggleSwitchIsAutoUpdateWithSilence.IsEnabled = true;
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"确认兼容性变更失败: {ex.Message}", LogHelper.LogType.Error);
}
}
private async void ManualUpdateButton_Click(object sender, RoutedEventArgs e)
{
ManualUpdateButton.IsEnabled = false;
+23 -1
View File
@@ -267,7 +267,7 @@ namespace Ink_Canvas
ToggleSwitchIsAutoUpdate.IsOn = Settings.Startup.IsAutoUpdate;
// 只有在启用了自动更新功能时才检查更新
if (Settings.Startup.IsAutoUpdate && !skipAutoUpdateCheck)
if (Settings.Startup.IsAutoUpdate && Settings.Startup.HasConfirmedNetCompatibilityChange && !skipAutoUpdateCheck)
{
if (isStartup)
{
@@ -288,6 +288,8 @@ namespace Ink_Canvas
ToggleSwitchIsAutoUpdateWithSilence.IsOn = true;
}
ApplyNetCompatibilityConfirmationGateToUpdateSettingsUi();
// 初始化更新通道选择
foreach (var radioButton in UpdateChannelSelector.Items)
{
@@ -1317,6 +1319,26 @@ namespace Ink_Canvas
try { RefreshConfigProfileList(); } catch (Exception ex) { LogHelper.WriteLogToFile($"刷新配置文件列表失败: {ex.Message}", LogHelper.LogType.Warning); }
}
private void ApplyNetCompatibilityConfirmationGateToUpdateSettingsUi()
{
bool confirmed = Settings?.Startup?.HasConfirmedNetCompatibilityChange == true;
if (Net472CompatibilityWarningPanel != null)
{
Net472CompatibilityWarningPanel.Visibility = confirmed ? Visibility.Collapsed : Visibility.Visible;
}
if (ToggleSwitchIsAutoUpdate != null)
{
ToggleSwitchIsAutoUpdate.IsEnabled = confirmed;
}
if (ToggleSwitchIsAutoUpdateWithSilence != null)
{
ToggleSwitchIsAutoUpdateWithSilence.IsEnabled = confirmed;
}
}
/// <summary>
/// 将画笔自动恢复相关的设置应用到界面控件并在启用时初始化自动恢复定时器。
/// </summary>