修复暂停功能

This commit is contained in:
zqm
2026-01-06 10:44:26 +08:00
parent 87dee33c76
commit f1b2698541
2 changed files with 6 additions and 7 deletions

View File

@@ -514,12 +514,12 @@ namespace JoyD.Windows.CS.Toprie
// 初始化Ping定时器 // 初始化Ping定时器
_pingTimer = new System.Threading.Timer(PingTimer_Tick, null, Timeout.Infinite, Timeout.Infinite); _pingTimer = new System.Threading.Timer(PingTimer_Tick, null, Timeout.Infinite, Timeout.Infinite);
InitializeImageBuffer();
// 异步初始化图像缓冲区和加载菜单配置避免阻塞UI线程 // 异步初始化图像缓冲区和加载菜单配置避免阻塞UI线程
ThreadPool.QueueUserWorkItem(delegate ThreadPool.QueueUserWorkItem(delegate
{ {
try try
{ {
InitializeImageBuffer();
LoadMenuConfig(); LoadMenuConfig();
Console.WriteLine("图像缓冲区和菜单配置已异步初始化完成"); Console.WriteLine("图像缓冲区和菜单配置已异步初始化完成");
} }
@@ -970,6 +970,7 @@ namespace JoyD.Windows.CS.Toprie
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
Console.WriteLine("控件已释放跳过UI更新");
} }
return; return;
} }
@@ -1018,8 +1019,7 @@ namespace JoyD.Windows.CS.Toprie
{ {
return; return;
} }
// 直接使用_lastImage引用避免创建不必要的副本 lastImage = (Image)_lastImage.Clone();
lastImage = _lastImage;
} }
} }
@@ -1028,8 +1028,7 @@ namespace JoyD.Windows.CS.Toprie
{ {
if (_infoImage != null) if (_infoImage != null)
{ {
// 直接使用_infoImage引用避免创建不必要的副本 infoImage = (Image)_infoImage.Clone();
infoImage = _infoImage;
} }
} }
@@ -1342,7 +1341,7 @@ namespace JoyD.Windows.CS.Toprie
ShowError(string.Empty); // 清除之前的错误信息 ShowError(string.Empty); // 清除之前的错误信息
// 按照README中要求的修改流程第2点和第6点连接状态变化时只在非暂停状态下调用更新Info // 按照README中要求的修改流程第2点和第6点连接状态变化时只在非暂停状态下调用更新Info
if (!_isPaused) if (_isFirst || !_isPaused)
{ {
UpdateInfo(); UpdateInfo();
} }

View File

@@ -33,6 +33,6 @@ using System.Runtime.InteropServices;
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyFileVersion("1.0.1.1")]
// NuGet包相关信息已在项目文件中配置 // NuGet包相关信息已在项目文件中配置