예제 #1
0
        /// <summary>
        /// Reads the hot key configuration and setup the UI elements accordingly
        /// </summary>
        /// <param name="Id">Configuration type to be read</param>
        /// <param name="cb">Checkbox to show enable/disable status</param>
        /// <param name="txt">Textbox to show description string</param>
        private void LoadHotKey(Shortcuts.SC_Type Id, CheckBox cb, TextBox txt)
        {
            ShortcutsKey key = sc.Key_Get(Id);

            cb.Checked = key.used;
            txt.Text   = key.GetDescriptionString();
        }
예제 #2
0
        private void RegisterHotKey(TextBox txt, Shortcuts.SC_Type Id, KeyEventArgs e)
        {
            ShortcutsKey key = new ShortcutsKey();

            if (e.KeyCode == Keys.ShiftKey)
            {
                return;
            }
            if (e.KeyCode == Keys.ControlKey)
            {
                return;
            }
            if (e.KeyCode == Keys.Alt)
            {
                return;
            }
            if (e.KeyCode == Keys.Menu)
            {
                return;                         // = Alt
            }
            // register hotkey
            key.key = e;
            sc.Key_Set(Id, key);

            txt.Text = key.GetDescriptionString();
        }
예제 #3
0
        /// <summary>
        /// Validates a hotkey and when enabled registers it
        /// </summary>
        private bool LoadHotKeySettings(Shortcuts.SC_Type Type, int KeyCode, bool Enable)
        {
            ShortcutsKey key = new ShortcutsKey();

            key.key = new KeyEventArgs((Keys)KeyCode);
            if (Enable)
            {
                sc.Key_Set(Type, key);
                if (!sc.Key_Get(Type).valid)
                {
                    return(false);
                }
            }
            else
            {
                sc.Key_PreSet(Type, key);
            }

            return(true);
        }