add:兼容性变更提示
This commit is contained in:
@@ -642,15 +642,15 @@
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#FF2A2A2A"
|
||||
FontSize="14"
|
||||
Text="此版本为最后一个基于.net framework 4.7.2版本,您需要手动确认才能继续接受自动更新。" />
|
||||
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"
|
||||
Background="#FFFFFFFF"
|
||||
BorderBrush="#FFE5E7EB"
|
||||
Foreground="#FF111827"
|
||||
Content="确认">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
@@ -667,10 +667,12 @@
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFE9B53C" />
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFF9FAFB" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="#FFD1D5DB" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFDCA628" />
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFF3F4F6" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF9CA3AF" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#FFE7E7E7" />
|
||||
|
||||
@@ -1180,7 +1180,7 @@ namespace Ink_Canvas
|
||||
loadPenCanvas();
|
||||
//加载设置
|
||||
LoadSettings(true);
|
||||
ShowNetCompatibilityChangePromptIfNeeded();
|
||||
ScheduleNetCompatibilityChangePromptAfterStartup();
|
||||
ApplyLanguageFromSettings();
|
||||
AutoBackupManager.Initialize(Settings);
|
||||
CheckUpdateChannelAndTelemetryConsistency();
|
||||
@@ -1506,7 +1506,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Settings?.Startup?.HasConfirmedNetCompatibilityChange == true)
|
||||
if (IsNetCompatibilityChangeConfirmed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1523,6 +1523,87 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
private void ScheduleNetCompatibilityChangePromptAfterStartup()
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// 等待主窗口启动流程与初始渲染基本完成后再提示,避免“刚启动就弹窗”。
|
||||
await Task.Delay(1000);
|
||||
ShowNetCompatibilityChangePromptIfNeeded();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"延迟显示兼容性变更提示失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}), DispatcherPriority.ApplicationIdle);
|
||||
}
|
||||
|
||||
private string GetNetCompatibilityConfirmationFlagPath()
|
||||
{
|
||||
return Path.Combine(App.RootPath, "Configs", "NetCompatibilityConfirmed.flag");
|
||||
}
|
||||
|
||||
private bool IsNetCompatibilityChangeConfirmed()
|
||||
{
|
||||
if (Settings?.Startup?.HasConfirmedNetCompatibilityChange == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var flagPath = GetNetCompatibilityConfirmationFlagPath();
|
||||
if (File.Exists(flagPath))
|
||||
{
|
||||
if (Settings?.Startup != null && !Settings.Startup.HasConfirmedNetCompatibilityChange)
|
||||
{
|
||||
Settings.Startup.HasConfirmedNetCompatibilityChange = true;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"读取兼容性确认标记失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void PersistNetCompatibilityChangeConfirmation()
|
||||
{
|
||||
if (Settings?.Startup == null)
|
||||
{
|
||||
Settings.Startup = new Startup();
|
||||
}
|
||||
|
||||
Settings.Startup.HasConfirmedNetCompatibilityChange = true;
|
||||
|
||||
try
|
||||
{
|
||||
var flagPath = GetNetCompatibilityConfirmationFlagPath();
|
||||
var dir = Path.GetDirectoryName(flagPath);
|
||||
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
if (!File.Exists(flagPath))
|
||||
{
|
||||
File.WriteAllText(flagPath, "confirmed=true");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"写入兼容性确认标记失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ApplyLanguageFromSettings()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -5360,13 +5360,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Settings?.Startup == null)
|
||||
{
|
||||
Settings.Startup = new Startup();
|
||||
}
|
||||
|
||||
Settings.Startup.HasConfirmedNetCompatibilityChange = true;
|
||||
SaveSettingsToFile();
|
||||
PersistNetCompatibilityChangeConfirmation();
|
||||
|
||||
if (Net472CompatibilityWarningPanel != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user