实现暂停状态下隐藏图像和色彩菜单
This commit is contained in:
@@ -1113,12 +1113,41 @@ namespace JoyD.Windows.CS.Toprie
|
||||
/// 右键菜单显示前的事件处理方法
|
||||
/// 用于更新色彩模式菜单项的选中状态
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// 右键菜单打开事件处理
|
||||
/// </summary>
|
||||
private void ContextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
// 暂停菜单项的文本已经在点击事件中更新,这里无需再次更新
|
||||
if (DesignMode) return;
|
||||
try
|
||||
{
|
||||
// 检查是否处于暂停状态
|
||||
bool isPaused = pauseImageUpdateToolStripMenuItem.Text == "恢复图像更新";
|
||||
|
||||
// 在暂停状态下,隐藏图像和色彩相关菜单
|
||||
if (isPaused)
|
||||
{
|
||||
thermalModeToolStripMenuItem.Visible = false;
|
||||
visibleModeToolStripMenuItem.Visible = false;
|
||||
fusionMode1ToolStripMenuItem.Visible = false;
|
||||
fusionMode2ToolStripMenuItem.Visible = false;
|
||||
fusionMode3ToolStripMenuItem.Visible = false;
|
||||
fusionMode4ToolStripMenuItem.Visible = false;
|
||||
fusionMode5ToolStripMenuItem.Visible = false;
|
||||
colorModeToolStripMenuItem.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 在非暂停状态下,显示图像模式相关菜单
|
||||
thermalModeToolStripMenuItem.Visible = true;
|
||||
visibleModeToolStripMenuItem.Visible = true;
|
||||
fusionMode1ToolStripMenuItem.Visible = true;
|
||||
fusionMode2ToolStripMenuItem.Visible = true;
|
||||
fusionMode3ToolStripMenuItem.Visible = true;
|
||||
fusionMode4ToolStripMenuItem.Visible = true;
|
||||
fusionMode5ToolStripMenuItem.Visible = true;
|
||||
|
||||
// 根据当前图像模式控制色彩模式菜单的可见性
|
||||
if (_deviceManager != null)
|
||||
{
|
||||
@@ -1145,7 +1174,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
rainbow2ToolStripMenuItem.Checked = false;
|
||||
|
||||
// 尝试获取当前色彩模式并更新对应菜单项的选中状态
|
||||
if (pauseImageUpdateToolStripMenuItem.Text == "暂停图像更新" && _deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Connected)
|
||||
if (_deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1183,7 +1212,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("获取当前色彩模式失败: " + ex.Message);
|
||||
Console.WriteLine($"获取当前色彩模式失败: {ex.Message}");
|
||||
}
|
||||
|
||||
// 更新视频模式菜单项的选中状态
|
||||
@@ -1196,13 +1225,14 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("获取当前图像模式失败: " + ex.Message);
|
||||
Console.WriteLine($"获取当前图像模式失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("更新右键菜单选中状态失败: " + ex.Message);
|
||||
Console.WriteLine($"更新右键菜单选中状态失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user