コード例 #1
0
        private void PressFunctionKeyCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var parameter = (VirtualKey)e.Parameter;

            switch (parameter.Key)
            {
            case Key.Tab:
                CurrentText += "\t";
                break;

            case Key.Space:
                CurrentText += " ";
                break;

            case Key.Back:
                if (CurrentText.Length > 0)
                {
                    CurrentText = CurrentText.Remove(CurrentText.Length - 1);
                }
                break;

            case Key.Enter:
                //                    ValidateDialog(this, new DialogResultEventArgs(true, CurrentText));
                Confirm(CurrentText);
                break;

            case Key.Escape:
                //                    ValidateDialog(this, new DialogResultEventArgs(false, null));
                Cancel();
                break;
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: grimmi/101Projects
 private void btnBack_Click(object sender, EventArgs e)
 {
     if (CurrentText.Length > 0)
     {
         CurrentText = CurrentText.Remove(CurrentText.Length - 1);
     }
 }
コード例 #3
0
        private void Editor_KeyPress(object sender, KeyPressEventArgs e)
        {
            bool textChanged = false;

            if (e.KeyChar == '\b') // backspace
            {
                if (CurrentText.Length > 0)
                {
                    CurrentText = CurrentText.Remove(CurrentText.Length - 1);
                    textChanged = true;
                }
            }
            else if (e.KeyChar == ' ' && !SpaceAccepts)
            {
                CurrentText += e.KeyChar;
                textChanged  = true;
            }
            else if (!char.IsControl(e.KeyChar))
            {
                CurrentText += e.KeyChar;
                textChanged  = true;
            }

            if (textChanged)
            {
                Editor.DoPrompt(Options.GetFullPrompt() + CurrentText);
                TextChanged(CurrentText);
            }
        }
コード例 #4
0
            public IEnumerator <PreprocessorToken> GetEnumerator()
            {
                MoveNext();
                while (CanMoveAgain)
                {
                    First = Current;
                    CurrentText.Clear();
                    var tokenType = PreprocessorTokenType.InvalidSequence;
                    if (IsNonDigit(Current))
                    {
                        tokenType = ParseRule(
                            IsNonDigit,
                            PreprocessorTokenType.Keyword);
                    }
                    else if (Current == '+')
                    {
                        tokenType = ParseCharacter('+');
                    }
                    else if (IsDigit(Current))
                    {
                        tokenType = ParseRule(
                            IsDigit,
                            PreprocessorTokenType.DecimalNumber);
                    }

                    if (CanMoveAgain)
                    {
                        CurrentText.Remove(CurrentText.Length - 1, 1);
                    }

                    yield return(new PreprocessorToken(
                                     CurrentText.ToString(),
                                     First,
                                     tokenType));
                }
            }