Ejemplo n.º 1
0
        public static int RegisterKey(Hotkey hotkey, HotkeyActivated callback, Window window)
        {
            IntPtr hwnd = new WindowInteropHelper(window).Handle;

            if (RegisterHotKey(hwnd, nextKeyId, hotkey.Mod, hotkey.Key))
            {
                Hotkeys.Add(hotkey, new HotkeyData {
                    Callback = callback, ID = nextKeyId
                });
            }
            else
            {
                return(-1);
            }
            return(nextKeyId++); // return then increase
        }
Ejemplo n.º 2
0
 protected void OnHotkeyActivated(EventArgs e)
 {
     HotkeyActivated?.Invoke(this, e);
 }
Ejemplo n.º 3
0
 protected virtual void OnKeyPressed(KeyEventArgs e)
 {
     HotkeyActivated?.Invoke(this, e);
 }