improve:兼容性变更提示
This commit is contained in:
@@ -1506,7 +1506,7 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsNetCompatibilityChangeConfirmed())
|
if (IsNetCompatibilityChangePromptAcknowledged() || IsNetCompatibilityChangeConfirmed())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1516,10 +1516,7 @@ namespace Ink_Canvas
|
|||||||
"兼容性变更",
|
"兼容性变更",
|
||||||
MessageBoxButton.OK,
|
MessageBoxButton.OK,
|
||||||
MessageBoxImage.Warning);
|
MessageBoxImage.Warning);
|
||||||
|
PersistNetCompatibilityChangePromptAcknowledgement();
|
||||||
// 用户关闭提示后即视为已知晓,持久化后下次启动不再弹出(与设置内「确认」按钮一致)。
|
|
||||||
PersistNetCompatibilityChangeConfirmation();
|
|
||||||
ApplyNetCompatibilityConfirmationGateToUpdateSettingsUi();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -1549,6 +1546,46 @@ namespace Ink_Canvas
|
|||||||
return Path.Combine(App.RootPath, "Configs", "NetCompatibilityConfirmed.flag");
|
return Path.Combine(App.RootPath, "Configs", "NetCompatibilityConfirmed.flag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetNetCompatibilityPromptAcknowledgedFlagPath()
|
||||||
|
{
|
||||||
|
return Path.Combine(App.RootPath, "Configs", "NetCompatibilityPromptAcknowledged.flag");
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsNetCompatibilityChangePromptAcknowledged()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return File.Exists(GetNetCompatibilityPromptAcknowledgedFlagPath());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"读取兼容性提示弹窗标记失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PersistNetCompatibilityChangePromptAcknowledgement()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var flagPath = GetNetCompatibilityPromptAcknowledgedFlagPath();
|
||||||
|
var dir = Path.GetDirectoryName(flagPath);
|
||||||
|
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!File.Exists(flagPath))
|
||||||
|
{
|
||||||
|
File.WriteAllText(flagPath, "acknowledged=true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"写入兼容性提示弹窗标记失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsNetCompatibilityChangeConfirmed()
|
private bool IsNetCompatibilityChangeConfirmed()
|
||||||
{
|
{
|
||||||
if (Settings?.Startup?.HasConfirmedNetCompatibilityChange == true)
|
if (Settings?.Startup?.HasConfirmedNetCompatibilityChange == true)
|
||||||
|
|||||||
Reference in New Issue
Block a user