Add hotkey global switch

This commit is contained in:
2023-09-29 15:04:30 +08:00
parent 1c49c41b71
commit 749f324f7d
13 changed files with 414 additions and 236 deletions

View File

@@ -587,6 +587,30 @@ namespace GrasscutterTools.Forms
if (i < ListPages.Items.Count)
ListPages.SelectedIndex = i;
}
else if (Common.KeyGo.IsEnabled == false)
{
foreach (var hotkeyItem in Common.KeyGo.Items)
{
if (!hotkeyItem.IsEnabled) continue;
var t = hotkeyItem.HotKey.LastIndexOf('+');
var key = (t >= 0) ? hotkeyItem.HotKey.Substring(t+1) : hotkeyItem.HotKey;
if (e.KeyCode != (Keys)Enum.Parse(typeof(Keys), key.Trim()))
continue;
if (t >= 0)
{
if (hotkeyItem.HotKey.Contains("Ctrl") && !e.Control)
continue;
if (hotkeyItem.HotKey.Contains("Shift") && !e.Shift)
continue;
if (hotkeyItem.HotKey.Contains("Alt") && !e.Alt)
continue;
}
BeginInvoke(new Func<Task>(() => RunRawCommands(hotkeyItem.Commands)));
break;
}
}
}
/// <summary>