コード例 #1
0
        }   // end of TextInput()

        // TODO (****) Clean this up.  We're mixing text as input with text as control here.
        // Probably the right thing to do would be to push/pop the text input callbacks
        // dynamically to mirror the state we're in.

        public void KeyInput(Keys key)
        {
            if (EditingCreator || EditingPin)
            {
                KeyboardInput.ClearAllWasPressedState(key);

                TextBlob curBlob = EditingCreator ? creatorBlob : pinBlob;
                //string curString = EditingCreator ? curCreator : curPin;
                //int curLength = curString.Length;

                switch (key)
                {
                case Keys.Enter:
                    Foley.PlayClickDown();
                    OnAccept();
                    break;

                case Keys.Escape:
                    Foley.PlayClickDown();
                    OnCancel();
                    break;

                case Keys.Left:
                    curBlob.CursorLeft();
                    Foley.PlayClickDown();
                    break;

                case Keys.Right:
                    curBlob.CursorRight();
                    Foley.PlayClickDown();
                    break;

                case Keys.Home:
                    Foley.PlayClickDown();
                    creatorBlob.Home();
                    break;

                case Keys.End:
                    Foley.PlayClickDown();
                    curBlob.End();
                    break;

                case Keys.Back:
                    curBlob.Backspace();
                    Foley.PlayClickDown();
                    break;

                case Keys.Delete:
                    curBlob.Delete();
                    break;

                case Keys.Tab:
                    ToggleEditTarget();
                    break;
                } // end of switch on special characters.
            }
        }         // end of KeyInput()