add:兼容性变更提示
This commit is contained in:
@@ -624,6 +624,65 @@
|
||||
</ikw:SimpleStackPanel>
|
||||
</ikw:SimpleStackPanel>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="Net472CompatibilityWarningPanel"
|
||||
Background="#FFFFF4C2"
|
||||
BorderBrush="#FFF0C24B"
|
||||
BorderThickness="1"
|
||||
CornerRadius="10"
|
||||
Padding="14,12"
|
||||
Margin="0,14,0,0"
|
||||
Visibility="Collapsed">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#FF2A2A2A"
|
||||
FontSize="14"
|
||||
Text="此版本为最后一个基于.net framework 4.7.2版本,您需要手动确认才能继续接受自动更新。" />
|
||||
<Button Grid.Column="1"
|
||||
Margin="14,0,0,0"
|
||||
Padding="18,6"
|
||||
MinWidth="92"
|
||||
Click="ConfirmNetCompatibilityChangeButton_Click"
|
||||
Background="#FFF0C24B"
|
||||
BorderBrush="#FFE0A800"
|
||||
Foreground="#FF1F1F1F"
|
||||
Content="确认">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="Bd"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="8"
|
||||
SnapsToDevicePixels="True">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
RecognizesAccessKey="True"
|
||||
Margin="{TemplateBinding Padding}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFE9B53C" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFDCA628" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFE7E7E7" />
|
||||
<Setter Property="Foreground" Value="#FF7A7A7A" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<GroupBox Name="GroupBoxModeSettings">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Margin="0,12,0,0" Text="{i18n:I18n Key=Settings_Mode}" FontWeight="Bold" Foreground="#fafafa"
|
||||
|
||||
@@ -1180,6 +1180,7 @@ namespace Ink_Canvas
|
||||
loadPenCanvas();
|
||||
//加载设置
|
||||
LoadSettings(true);
|
||||
ShowNetCompatibilityChangePromptIfNeeded();
|
||||
ApplyLanguageFromSettings();
|
||||
AutoBackupManager.Initialize(Settings);
|
||||
CheckUpdateChannelAndTelemetryConsistency();
|
||||
@@ -1501,6 +1502,27 @@ namespace Ink_Canvas
|
||||
AddTouchSupportToSliders();
|
||||
}
|
||||
|
||||
private void ShowNetCompatibilityChangePromptIfNeeded()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Settings?.Startup?.HasConfirmedNetCompatibilityChange == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MessageBox.Show(
|
||||
"下个版本将更换.NET6,请前往设置确认以便继续使用自动更新",
|
||||
"兼容性变更",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Warning);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"兼容性变更提示弹窗失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyLanguageFromSettings()
|
||||
{
|
||||
try
|
||||
@@ -1917,6 +1939,12 @@ namespace Ink_Canvas
|
||||
|
||||
private async void AutoUpdate()
|
||||
{
|
||||
if (Settings?.Startup?.HasConfirmedNetCompatibilityChange != true)
|
||||
{
|
||||
LogHelper.WriteLogToFile("AutoUpdate | 自动更新已暂停:未确认兼容性变更(NET472 -> .NET6)", LogHelper.LogType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Settings.Startup.AutoUpdatePauseUntilDate))
|
||||
{
|
||||
if (DateTime.TryParse(Settings.Startup.AutoUpdatePauseUntilDate, out DateTime pauseUntilDate))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -250,6 +250,8 @@ namespace Ink_Canvas
|
||||
public bool HasAcceptedTelemetryPrivacy { get; set; } = false;
|
||||
[JsonProperty("hasShownOobe")]
|
||||
public bool HasShownOobe { get; set; } = false;
|
||||
[JsonProperty("hasConfirmedNetCompatibilityChange")]
|
||||
public bool HasConfirmedNetCompatibilityChange { get; set; } = false;
|
||||
}
|
||||
|
||||
public class Appearance
|
||||
|
||||
Reference in New Issue
Block a user