示例#1
0
        private static void InitializeHotkeys()
        {
            if (hotkeyHelper != null)
            {
                return;
            }

            hotkeyHelper = new HotkeyHelper();

            hotkeyHelper.RegisterKeyAction(Keys.T, HotkeyModifiers.Ctrl, () =>
            {
                var foregroundWindow = WinApi.GetForegroundWindow();

                if ((foregroundWindow == IntPtr.Zero) ||
                    !windows.TryGetValue(foregroundWindow, out HudWindowItem window) ||
                    window.Window == null)
                {
                    return;
                }

                window.Window.Dispatcher.Invoke(() => window.Window.ViewModel?.TagLastHandsCommand.Execute(EnumHandTag.ForReview));
            });

            hotkeyHelper.SetHotkeys();
        }