Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        static private string AppendErrKey(KB9Validation.ERR_VALIDATION err)
        {
            switch (err)
            {
            case KB9Validation.ERR_VALIDATION.Less_ShiftDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.ShiftKey));

            case KB9Validation.ERR_VALIDATION.Less_ShiftUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.ShiftKey));

            case KB9Validation.ERR_VALIDATION.Less_RShiftDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.RShiftKey));

            case KB9Validation.ERR_VALIDATION.Less_RShiftUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RShiftKey));

            case KB9Validation.ERR_VALIDATION.Less_CtrlDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.ControlKey));

            case KB9Validation.ERR_VALIDATION.Less_CtrlUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.ControlKey));

            case KB9Validation.ERR_VALIDATION.Less_RCtrlDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.RControlKey));

            case KB9Validation.ERR_VALIDATION.Less_RCtrlUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RControlKey));

            case KB9Validation.ERR_VALIDATION.Less_AltDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.Menu));

            case KB9Validation.ERR_VALIDATION.Less_AltUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.Menu));

            case KB9Validation.ERR_VALIDATION.Less_RAltDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.RMenu));

            case KB9Validation.ERR_VALIDATION.Less_RAltUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RMenu));

            case KB9Validation.ERR_VALIDATION.Less_WinDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.LWin));

            case KB9Validation.ERR_VALIDATION.Less_WinUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.LWin));

            case KB9Validation.ERR_VALIDATION.Less_RWinDown:
                return(KB9KeyDefinition.KeyDisplayName(Keys.RWin));

            case KB9Validation.ERR_VALIDATION.Less_RWinUp:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RWin));
            }
            return("");
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        static private string RemoveErrKey(KB9Validation.ERR_VALIDATION err)
        {
            switch (err)
            {
            case KB9Validation.ERR_VALIDATION.Less_ShiftDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.ShiftKey));

            //case KB9Validation.ERR_VALIDATION.Less_ShiftUp:
            //    return KB9KeyDefinition.KeyUpDisplayName(Keys.ShiftKey);
            case KB9Validation.ERR_VALIDATION.Less_RShiftDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RShiftKey));

            //case KB9Validation.ERR_VALIDATION.Less_RShiftUp:
            //    return KB9KeyDefinition.KeyUpDisplayName(Keys.RShiftKey);
            case KB9Validation.ERR_VALIDATION.Less_CtrlDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.ControlKey));

            //case KB9Validation.ERR_VALIDATION.Less_CtrlUp:
            //    return KB9KeyDefinition.KeyUpDisplayName(Keys.ControlKey);
            case KB9Validation.ERR_VALIDATION.Less_RCtrlDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RControlKey));

            //case KB9Validation.ERR_VALIDATION.Less_RCtrlUp:
            //    return KB9KeyDefinition.KeyUpDisplayName(Keys.RControlKey);
            case KB9Validation.ERR_VALIDATION.Less_AltDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.Menu));

            //case KB9Validation.ERR_VALIDATION.Less_AltUp:
            //    return KB9KeyDefinition.KeyUpDisplayName(Keys.Menu);
            case KB9Validation.ERR_VALIDATION.Less_RAltDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RMenu));

            //case KB9Validation.ERR_VALIDATION.Less_RAltUp:
            //    return KB9KeyDefinition.KeyUpDisplayName(Keys.RMenu);

            case KB9Validation.ERR_VALIDATION.Less_WinDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.LWin));

            //case KB9Validation.ERR_VALIDATION.Less_WinUp:
            //    return KB9KeyDefinition.KeyUpDisplayName(Keys.LWin);
            case KB9Validation.ERR_VALIDATION.Less_RWinDown:
                return(KB9KeyDefinition.KeyUpDisplayName(Keys.RWin));
                //case KB9Validation.ERR_VALIDATION.Less_RWinUp:
                //    return KB9KeyDefinition.KeyUpDisplayName(Keys.RWin);
                //case KB9Validation.ERR_VALIDATION.Single_Function_With_Up:
            }
            return("");
        }