fix: 修复更新后保存gui.json时冲突的问题

This commit is contained in:
MistEO
2022-10-30 00:33:30 +08:00
committed by zzyyyl
parent 0f60226522
commit b64933750c
3 changed files with 15 additions and 2 deletions

View File

@@ -142,7 +142,7 @@ namespace MeoAsstGui
// 注销任务栏图标
_trayIconInSettingsViewModel.Close();
ViewStatusStorage.Save();
ViewStatusStorage.Release();
}
/// <inheritdoc/>

View File

@@ -128,6 +128,11 @@ namespace MeoAsstGui
/// <returns>Whether the operation is successful.</returns>
public static bool Save()
{
if (_released)
{
return false;
}
try
{
var jsonStr = _viewStatus.ToString();
@@ -152,6 +157,14 @@ namespace MeoAsstGui
return true;
}
private static bool _released = false;
public static void Release()
{
Save();
_released = true;
}
/// <summary>
/// Backs up configuration daily. (#2145)
/// </summary>

View File

@@ -288,7 +288,7 @@ namespace MeoAsstGui
// 保存更新信息,下次启动后会弹出已更新完成的提示
UpdatePackageName = string.Empty;
ViewStatusStorage.Save();
ViewStatusStorage.Release();
// 重启进程(启动的是更新后的程序了)
var newProcess = new Process();