How to add the ".com" to inputtextbox when.com key is pressed in predefined keyboard template in UWP application

DhanaLakshmi MURUGAN 0 Reputation points
2023-10-26T17:41:12.89+00:00
void HandleCharKeyPress(Button button)
        {
            InputInjector inputInjector = InputInjector.TryCreate();
            var ch = button.Content.ToString();

            string upperCaseStr = ch.ToUpper();
            

            bool isUpperCase_srcSame = ch.Equals(upperCaseStr);
            if(upperCaseStr==".COM")
            {
                isUpperCase_srcSame = true;
            }

            #region lower case Alphabets
            if (isUpperCase_srcSame == false)
            {
                //Lower case

                var key = new InjectedInputKeyboardInfo();

                if (ch.Equals("a"))
                {
                    key.VirtualKey = (ushort)(VirtualKey.A);
                }
                else if (ch.Equals("b"))
                {.......so on
  //https://stackoverflow.com/questions/48879320/uwp-injectedinputkeyboardinfo-how-to-send-non-english-keystrokes
                    else if (ch.Equals("#") || ch.Equals("$") || ch.Equals("%") || ch.Equals("^") || ch.Equals("&")
                         || ch.Equals("@") || ch.Equals("(") || ch.Equals(")") || ch.Equals("_") || ch.Equals(":")
                         || ch.Equals(";") || ch.Equals(",") || ch.Equals(".") || ch.Equals("!") || ch.Equals("?")
                         || ch.Equals("[") || ch.Equals("]") || ch.Equals("{") || ch.Equals("}") || ch.Equals("~")
                         || ch.Equals("`") || ch.Equals("=") || ch.Equals("|") || ch.Equals("'") || ch.Equals("\"")
                          || ch.Equals("\\") || ch.Equals("<") || ch.Equals(">"))
                    {
                        char c = ch[0];
                        reqKey.ScanCode = (ushort)c;
                        @reqKey.KeyOptions = InjectedInputKeyOptions.Unicode;
                    }
                    else if(ch.Equals(".com"))
                    {
                        char c = ch[0];
                        reqKey.ScanCode = (ushort)c;
                        @reqKey.KeyOptions = InjectedInputKeyOptions.Unicode;
                    }

here I cant able to take the ".com" either iget "." or using foreach getting "m", please help me to take out the whole ".com"

Universal Windows Platform (UWP)
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.