Exemple #1
0
        private void InputText_TextChanged(object sender, TextChangedEventArgs e)
        {
            string input = new TextRange(InputText.Document.ContentStart, InputText.Document.ContentEnd).Text;

            /*if (!String.IsNullOrWhiteSpace(input) && !String.IsNullOrEmpty(input))
             * {
             *  var _input = input.Trim();
             *  if (_input.ElementAt(_input.Length - 1).Equals(';'))
             *  {
             *      InputText.TextChanged -= new TextChangedEventHandler(InputText_TextChanged);
             *      InputText.Document.Blocks.Clear();
             *      var lines = input.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
             *      InputText.AppendText(lines.First());
             *      lines.RemoveAt(0);
             *      lines.ForEach(str => InputText.AppendText(Environment.NewLine + str));
             *      InputText.AppendText(Environment.NewLine);
             *      InputText.CaretPosition = InputText.CaretPosition.DocumentEnd;
             *      InputText.TextChanged += new TextChangedEventHandler(InputText_TextChanged);
             *  }
             * }*/
            var enumerator     = input.GetEnumerator();
            int duplicateSpace = 0;

            while (enumerator.MoveNext())
            {
                if (enumerator.Current.Equals(' '))
                {
                    duplicateSpace++;
                    CompileButton.IsEnabled = duplicateSpace > 1 ? false : true;
                }
                else
                {
                    duplicateSpace = 0;
                }
            }
        }
Exemple #2
0
 protected override IEnumerator <TextPoint> GetEnumeratorInternal()
 {
     return(_bufferRange.GetEnumerator());
 }
 protected override IEnumerator <DisplayTextPoint> GetDisplayPointEnumeratorInternal()
 {
     return(TextRange.GetEnumerator());
 }