ACPAddIn.ThisAddIn.checkHotkeysModifiers C# (CSharp) Méthode

checkHotkeysModifiers() private méthode

private checkHotkeysModifiers ( String function ) : Boolean
function String
Résultat Boolean
        private Boolean checkHotkeysModifiers(String function)
        {
            Boolean result = false;
            Boolean result1 = false;
            Boolean result2 = false;
            int VK_LCONTROL = 0xA2;
            int VK_RCONTROL = 0xA3;
            int VK_LALT = 0xA4;
            int VK_RALT = 0xA5;
            int VK_LSHIFT = 0xA0;
            int VK_RSHIFT = 0xA1;

            switch (function)
            {
                case "triggerSuggestionPopUp":
                    if (triggerSuggestionPopUpKeyMod1.Equals("CTRL"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (triggerSuggestionPopUpKeyMod1.Equals("ALT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (triggerSuggestionPopUpKeyMod1.Equals("SHIFT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (triggerSuggestionPopUpKeyMod1.Equals("0"))
                        result1 = true;

                    if (triggerSuggestionPopUpKeyMod2.Equals("CTRL"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (triggerSuggestionPopUpKeyMod2.Equals("ALT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (triggerSuggestionPopUpKeyMod2.Equals("SHIFT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (triggerSuggestionPopUpKeyMod2.Equals("0"))
                        result2 = true;
                    break;

                case "extendWord":
                    if (extendWordKeyMod1.Equals("CTRL"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (extendWordKeyMod1.Equals("ALT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (extendWordKeyMod1.Equals("SHIFT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (extendWordKeyMod1.Equals("0"))
                        result1 = true;

                    if (extendWordKeyMod2.Equals("CTRL"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (extendWordKeyMod2.Equals("ALT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (extendWordKeyMod2.Equals("SHIFT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (extendWordKeyMod2.Equals("0"))
                        result2 = true;
                    break;

                case "removeWord":
                    if (reduceWordKeyMod1.Equals("CTRL"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (reduceWordKeyMod1.Equals("ALT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (reduceWordKeyMod1.Equals("SHIFT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (reduceWordKeyMod1.Equals("0"))
                        result1 = true;

                    if (reduceWordKeyMod2.Equals("CTRL"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (reduceWordKeyMod2.Equals("ALT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (reduceWordKeyMod2.Equals("SHIFT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (reduceWordKeyMod2.Equals("0"))
                        result2 = true;
                    break;

                case "extendSentence":
                    if (extendSentenceKeyMod1.Equals("CTRL"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (extendSentenceKeyMod1.Equals("ALT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (extendSentenceKeyMod1.Equals("SHIFT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (extendSentenceKeyMod1.Equals("0"))
                        result1 = true;

                    if (extendSentenceKeyMod2.Equals("CTRL"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (extendSentenceKeyMod2.Equals("ALT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (extendSentenceKeyMod2.Equals("SHIFT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (extendSentenceKeyMod2.Equals("0"))
                        result2 = true;
                    break;

                case "removeSentence":
                    if (reduceSentenceKeyMod1.Equals("CTRL"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (reduceSentenceKeyMod1.Equals("ALT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (reduceSentenceKeyMod1.Equals("SHIFT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (reduceSentenceKeyMod1.Equals("0"))
                        result1 = true;

                    if (reduceSentenceKeyMod2.Equals("CTRL"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (reduceSentenceKeyMod2.Equals("ALT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (reduceSentenceKeyMod2.Equals("SHIFT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (reduceSentenceKeyMod2.Equals("0"))
                        result2 = true;
                    break;

                case "extendParagraph":
                    if (extendParagraphKeyMod1.Equals("CTRL"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (extendParagraphKeyMod1.Equals("ALT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (extendParagraphKeyMod1.Equals("SHIFT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (extendParagraphKeyMod1.Equals("0"))
                        result1 = true;

                    if (extendParagraphKeyMod2.Equals("CTRL"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (extendParagraphKeyMod2.Equals("ALT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (extendParagraphKeyMod2.Equals("SHIFT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (extendParagraphKeyMod2.Equals("0"))
                        result2 = true;
                    break;

                case "removeParagraph":
                    if (reduceParagraphKeyMod1.Equals("CTRL"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (reduceParagraphKeyMod1.Equals("ALT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (reduceParagraphKeyMod1.Equals("SHIFT"))
                        result1 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (reduceParagraphKeyMod1.Equals("0"))
                        result1 = true;

                    if (reduceParagraphKeyMod2.Equals("CTRL"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LCONTROL)) || Convert.ToBoolean(GetAsyncKeyState(VK_RCONTROL)));
                    else if (reduceParagraphKeyMod2.Equals("ALT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LALT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RALT)));
                    else if (reduceParagraphKeyMod2.Equals("SHIFT"))
                        result2 = (Convert.ToBoolean(GetAsyncKeyState(VK_LSHIFT)) || Convert.ToBoolean(GetAsyncKeyState(VK_RSHIFT)));
                    else if (reduceParagraphKeyMod2.Equals("0"))
                        result2 = true;
                    break;
            }

            if (result1 && result2)
                result = true;

            return result;
        }