KPFloatingPanel.MainForm.update_shortcut_key C# (CSharp) Method

update_shortcut_key() private method

private update_shortcut_key ( ) : void
return void
        private void update_shortcut_key()
        {
            HotKeyboardHook.ModifierKeys m_keys = 0;
            if (FOptions.shortcutShift)
                m_keys |= HotKeyboardHook.ModifierKeys.Shift;
            if (FOptions.shortcutAlt)
                m_keys |= HotKeyboardHook.ModifierKeys.Alt;
            if (FOptions.shortcutCntrl)
                m_keys |= HotKeyboardHook.ModifierKeys.Control;
            if (FOptions.shortcutWin)
                m_keys |= HotKeyboardHook.ModifierKeys.Win;
            if (kb_shortcut != null && (shortcut_last_mod != m_keys || shortcut_last_key != FOptions.shortcutKey)) {
                kb_shortcut.Dispose();
                kb_shortcut = null;
            }
            if (kb_shortcut == null && !string.IsNullOrEmpty(FOptions.shortcutKey) && m_keys != 0) {
                kb_shortcut = new HotKeyboardHook();
                kb_shortcut.KeyPressed += handle_keyboard_shortcut;

                char key = FOptions.shortcutKey[0];
                try
                {
                    kb_shortcut.RegisterHotKey(m_keys, (Keys) key);
                }catch (Exception e)
                {
                    MessageBox.Show("KPFloatingPanel: Unable to register QuickPass hotkey due to: " + e.Message);
                }
                shortcut_last_key = FOptions.shortcutKey;
                shortcut_last_mod = m_keys;
            }
        }