Exemplo n.º 1
0
        public Purpose GetHotkey(Key hotkeyId)
        {
            int modifier = 0;

            if (altDown)
            {
                modifier |= MOD_ALT;
            }

            if (ctrlDown)
            {
                modifier |= MOD_CONTROL;
            }

            if (winDown)
            {
                modifier |= MOD_WIN;
            }

            HotkeySignature signature = new HotkeySignature(hotkeyId, modifier);

            if (this.hotkeys.ContainsKey(signature))
            {
                return(this.hotkeys[signature]);
            }

            return(Purpose.None);
        }
Exemplo n.º 2
0
        /// <summary>Register the hotkey</summary>
        public short RegisterGlobalHotkey(Key hotkey, int modifiers, Purpose purpose)
        {
            try
            {
                HotkeySignature signature = new HotkeySignature(hotkey, modifiers);
                this.hotkeys.Add(signature, purpose);
                return(hotkeyCount++);
            }
            catch (Exception ex)
            {
                // clean up if hotkey registration failed
                Dispose();
                Console.WriteLine(ex);
            }

            return(-1);
        }
Exemplo n.º 3
0
        /// <summary>Register the hotkey</summary>
        public short RegisterGlobalHotkey(Key hotkey, int modifiers, Purpose purpose)
        {
            try
            {
                HotkeySignature signature = new HotkeySignature(hotkey, modifiers);
                this.hotkeys.Add(signature, purpose);
                return hotkeyCount++;
            }
            catch (Exception ex)
            {
                // clean up if hotkey registration failed
                Dispose();
                Console.WriteLine(ex);
            }

            return -1;
        }
Exemplo n.º 4
0
        public Purpose GetHotkey(Key hotkeyId)
        {
            int modifier = 0;
            if (altDown)
            {
                modifier |= MOD_ALT;
            }

            if (ctrlDown)
            {
                modifier |= MOD_CONTROL;
            }

            if (winDown)
            {
                modifier |= MOD_WIN;
            }

            HotkeySignature signature = new HotkeySignature(hotkeyId, modifier);

            if (this.hotkeys.ContainsKey(signature))
            {
                return this.hotkeys[signature];
            }

            return Purpose.None;
        }