Revert "优化代码"

This reverts commit 92bb458345.
This commit is contained in:
2025-09-30 19:15:03 +08:00
parent d9e3524211
commit a9b0ac0595
16 changed files with 131 additions and 71 deletions
+9 -5
View File
@@ -211,18 +211,22 @@ namespace Ink_Canvas
// 获取全局快捷键管理器
var hotkeyManagerField = typeof(MainWindow).GetField("_globalHotkeyManager",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
if (hotkeyManagerField?.GetValue(mainWin) is GlobalHotkeyManager hotkeyManager)
var hotkeyManager = hotkeyManagerField?.GetValue(mainWin) as GlobalHotkeyManager;
if (hotkeyManager != null)
{
// 禁用所有快捷键
hotkeyManager.DisableHotkeyRegistration();
// 更新菜单项文本和状态
if (sender is MenuItem menuItem)
var menuItem = sender as MenuItem;
if (menuItem != null)
{
if (menuItem.Header is SimpleStackPanel headerPanel)
var headerPanel = menuItem.Header as SimpleStackPanel;
if (headerPanel != null)
{
if (headerPanel.Children[0] is TextBlock textBlock)
var textBlock = headerPanel.Children[0] as TextBlock;
if (textBlock != null)
{
if (textBlock.Text == "禁用所有快捷键")
{