예제 #1
0
        private void UpdateHotkey(HotkeySelectControl hkControl, Hotkey hotkey, HandledEventHandler hkEvent)
        {
            if (hkControl.Hotkey == Keys.None && hotkey.Registered)
            {
                hotkey.Pressed -= hkEvent;
                hotkey.Unregister();
                hotkey.KeyCode = Keys.None;
            }
            else
            {
                hotkey.KeyCode = hkControl.Hotkey;
                hotkey.Win = hkControl.Win;
                hotkey.Ctrl = hkControl.Ctrl;
                hotkey.Shift = hkControl.Shift;
                hotkey.Alt = hkControl.Alt;

                if (!hotkey.Registered && hotkey.KeyCode != Keys.None)
                {
                    hotkey.Register(this);
                    hotkey.Pressed += hkEvent;
                }
            }
        }
예제 #2
0
 private void PopulateHotkeyControl(HotkeySelectControl khControl, Hotkey hk)
 {
     khControl.Hotkey = hk.KeyCode;
     khControl.Win = hk.Win;
     khControl.Ctrl = hk.Ctrl;
     khControl.Shift = hk.Shift;
     khControl.Alt = hk.Alt;
 }