修改UpdateInfo方法,在就绪状态时调用更新UI
This commit is contained in:
@@ -87,7 +87,7 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
DeviceManager.IsDesignMode = DesignMode;
|
DeviceManager.IsDesignMode = DesignMode;
|
||||||
Console.WriteLine($"相机控件设计模式状态已更新: {DesignMode}");
|
Console.WriteLine($"相机控件设计模式状态已更新: {DesignMode}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新InfoImage显示 - 按照用户要求的详细步骤:
|
/// 更新InfoImage显示 - 按照用户要求的详细步骤:
|
||||||
/// 1. 以透明色清空Info
|
/// 1. 以透明色清空Info
|
||||||
@@ -96,15 +96,15 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
/// 4. 最后调用更新UI
|
/// 4. 最后调用更新UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateInfo()
|
private void UpdateInfo()
|
||||||
{
|
{
|
||||||
// 更新Ping状态到Info文本
|
// 更新Ping状态到Info文本
|
||||||
Console.WriteLine($"Ping状态更新: {(IsDevicePingable ? "可Ping通" : "不可Ping通")}");
|
Console.WriteLine($"Ping状态更新: {(IsDevicePingable ? "可Ping通" : "不可Ping通")}");
|
||||||
if (DesignMode) return;
|
if (DesignMode) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lock (_infoImageLock)
|
lock (_infoImageLock)
|
||||||
{
|
{
|
||||||
// 检查连接状态
|
// 检查连接状态
|
||||||
bool isDisconnected = _deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Disconnected;
|
bool isDisconnected = _deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Disconnected;
|
||||||
bool isReconnecting = _deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Reconnecting;
|
bool isReconnecting = _deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Reconnecting;
|
||||||
@@ -117,10 +117,10 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
{
|
{
|
||||||
// 步骤1:以透明色清空Info
|
// 步骤1:以透明色清空Info
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
|
|
||||||
// 步骤2:检查暂停状态、Ping状态和连接状态
|
// 步骤2:检查暂停状态、Ping状态和连接状态
|
||||||
if (isPaused)
|
if (isPaused)
|
||||||
{
|
{
|
||||||
// 暂停状态 - 最高优先级
|
// 暂停状态 - 最高优先级
|
||||||
// 绘制暂停文本
|
// 绘制暂停文本
|
||||||
string text = "暂停";
|
string text = "暂停";
|
||||||
@@ -138,7 +138,7 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isPingFailed || isDisconnected || isReconnecting)
|
else if (isPingFailed || isDisconnected || isReconnecting)
|
||||||
{
|
{
|
||||||
// 非暂停状态下,检查Ping状态和连接状态
|
// 非暂停状态下,检查Ping状态和连接状态
|
||||||
|
|
||||||
// 确定显示的文本和颜色
|
// 确定显示的文本和颜色
|
||||||
@@ -174,16 +174,19 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置显示标志
|
// 设置显示标志
|
||||||
_isDisplayingInfo = (isPaused || isDisconnected || isReconnecting || _showGlobalTemperature || _showAreaTemperature);
|
_isDisplayingInfo = (isPaused || isDisconnected || isReconnecting || _showGlobalTemperature || _showAreaTemperature);
|
||||||
|
|
||||||
|
// 步骤3:如果就绪,调用更新UI
|
||||||
|
if (isReady)
|
||||||
|
{
|
||||||
|
UpdateImageOnUI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 步骤4:最后调用更新UI(注意:在DeviceManager_ImageReceived中已处理非暂停状态下的UI更新)
|
|
||||||
// 这里不再直接调用UpdateImageOnUI,避免重复更新
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"更新Info显示时出错: {ex.Message}");
|
Console.WriteLine($"更新Info显示时出错: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user