コード例 #1
0
        public void CharacterEntered(object sender, MangoKeyEventArgs e)
        {
            string letter = e.KeyPressed.ToString();

            if (letter.Length > 1)
            {
                if (letter.Contains("Shift"))
                    shiftPressed = true;
                if (letter == "Back")
                {
                    if (NewName.Length > 0)
                        NewName = NewName.Remove(NewName.Length - 1, 1);
                }
                else if (letter == "Space")
                    NewName += " ";
                else if (letter == "OemPeriod")
                    NewName += ".";
                else if (letter.StartsWith("D") && letter.Length == 2)
                {
                    if (shiftPressed)
                    {
                        if (letter.Substring(1, 1) == "1")
                            NewName += "!";
                        else
                            NewName += (letter.Substring(1, 1));
                    }
                    else
                        NewName += (letter.Substring(1, 1));
                }

            }
            else
            {
                if (shiftPressed)
                    NewName += letter;
                else
                    NewName += letter.ToLower(); ;
            }

            if (NewName.Length > 8) NewName = NewName.Remove(8);
        }
コード例 #2
0
        public void CharacterReleased(object sender, MangoKeyEventArgs e)
        {
            string letter = e.KeyPressed.ToString();

            if (letter.Length > 1)
            {
                if (letter.Contains("Shift"))
                    shiftPressed = false;
            }
        }