Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="strKeyCodes"></param>
        /// <returns></returns>
        private ERR_VALIDATION CheckCtrlUp(string strKeyCodes)
        {
            string s = strKeyCodes;

            //if (s == "[Ctrl]" ||
            //   s == "[RightCtrl]")
            //    return ERR_VALIDATION.OK;
            if (this.AllowSingleFunctionKey)
            {
                if (s == KB9Const.CTRL_DOWN || s == KB9Const.RCTRL_DOWN)
                {
                    return(ERR_VALIDATION.OK);
                }

                if (s == KB9Const.Ctrl_DownUp() ||
                    s == KB9Const.RCtrl_DownUp())
                {
                    return(ERR_VALIDATION.Single_Function_With_Up);
                }
                //s = adjust_allow_last_extend_function_key(s, KB9Const.CTRL_DOWN);
                //s = adjust_allow_last_extend_function_key(s, KB9Const.RCTRL_DOWN);
            }
            //if there is [Shift], or [RShift], string must have corresponded [#Shift] or [#RShift]
            ERR_KEYPAIR err = CheckKeyPair(s, KB9KeyDefinition.KeyDisplayName(Keys.ControlKey), KB9KeyDefinition.KeyUpDisplayName(Keys.ControlKey));

            if (err == ERR_KEYPAIR.Less_Down)
            {
                return(ERR_VALIDATION.Less_CtrlDown);
            }
            if (err == ERR_KEYPAIR.Less_Up)
            {
                return(ERR_VALIDATION.Less_CtrlUp);
            }
            if (err == ERR_KEYPAIR.Up_Before_Down)
            {
                return(ERR_VALIDATION.DownUp_Messed);
            }

            err = CheckKeyPair(s, KB9KeyDefinition.KeyDisplayName(Keys.RControlKey), KB9KeyDefinition.KeyUpDisplayName(Keys.RControlKey));
            if (err == ERR_KEYPAIR.Less_Down)
            {
                return(ERR_VALIDATION.Less_RCtrlDown);
            }
            if (err == ERR_KEYPAIR.Less_Up)
            {
                return(ERR_VALIDATION.Less_RCtrlUp);
            }
            if (err == ERR_KEYPAIR.Up_Before_Down)
            {
                return(ERR_VALIDATION.DownUp_Messed);
            }

            return(ERR_VALIDATION.OK);
        }
Example #2
0
        /// <summary>
        /// check if the [#Shift] was existed with [Shift]
        /// </summary>
        /// <param name="strKeyCodes"></param>
        /// <returns></returns>
        private ERR_VALIDATION CheckShiftUp(string strKeyCodes)
        {
            string s = strKeyCodes;

            if (this.AllowSingleFunctionKey)
            {
                //   s = adjust_allow_last_extend_function_key(s, KB9Const.SHIFT_DOWN);
                //   s = adjust_allow_last_extend_function_key(s, KB9Const.RSHIFT_DOWN);
                if (s == KB9Const.SHIFT_DOWN || s == KB9Const.RSHIFT_DOWN)
                {
                    return(ERR_VALIDATION.OK);
                }

                if (s == KB9Const.Shift_DownUp() ||
                    s == KB9Const.RShift_DownUp())
                {
                    return(ERR_VALIDATION.Single_Function_With_Up);
                }
            }


            //if there is [Shift], or [RShift], string must have corresponded [#Shift] or [#RShift]
            ERR_KEYPAIR err = CheckKeyPair(s, KB9KeyDefinition.KeyDisplayName(Keys.ShiftKey), KB9KeyDefinition.KeyUpDisplayName(Keys.ShiftKey));

            if (err == ERR_KEYPAIR.Less_Down)
            {
                return(ERR_VALIDATION.Less_ShiftDown);
            }
            if (err == ERR_KEYPAIR.Less_Up)
            {
                return(ERR_VALIDATION.Less_ShiftUp);
            }
            if (err == ERR_KEYPAIR.Up_Before_Down)
            {
                return(ERR_VALIDATION.DownUp_Messed);
            }

            err = CheckKeyPair(s, KB9KeyDefinition.KeyDisplayName(Keys.RShiftKey), KB9KeyDefinition.KeyUpDisplayName(Keys.RShiftKey));
            if (err == ERR_KEYPAIR.Less_Down)
            {
                return(ERR_VALIDATION.Less_RShiftDown);
            }
            if (err == ERR_KEYPAIR.Less_Up)
            {
                return(ERR_VALIDATION.Less_RShiftUp);
            }
            if (err == ERR_KEYPAIR.Up_Before_Down)
            {
                return(ERR_VALIDATION.DownUp_Messed);
            }

            return(ERR_VALIDATION.OK);
        }