Пример #1
0
        private void BackgroundWorker1_ProgressChanged(object sender,
                                                       ProgressChangedEventArgs e)
        {
            CurrentText = Clipboard.GetText();

            // only if clipboard was not empty
            if (CurrentText.Length > 0)
            {
                if (CurrentText.CompareTo(PreviousText) != 0)
                {
                    PreviousText = CurrentText;
                    itemList.Items.Insert(0, CurrentText.ToString());
                    // select current item
                    itemList.SelectedIndex = 0;
                }
            }
        }
Пример #2
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));
                }
            }