コード例 #1
0
            public override bool TryToMerge(IAction followingAction)
            {
                InsertTextAction next = followingAction as InsertTextAction;

                if (next != null && next.Textbox == this.Textbox)
                {
                    if (next.selectionStart == this.selectionStart + textToInsert.Length)
                    {
                        this.selectionLength += next.selectionLength;
                        this.deletedText     += next.deletedText;
                        this.textToInsert    += next.textToInsert;
                        next.Execute();
                        return(true);
                    }
                    if (next.selectionStart + next.selectionLength == this.selectionStart)
                    {
                        this.selectionStart  -= next.selectionLength;
                        this.selectionLength += next.selectionLength;
                        this.deletedText      = next.deletedText + this.deletedText;
                        this.textToInsert     = next.textToInsert + this.textToInsert;
                        next.Execute();
                        return(true);
                    }
                }
                return(false);
            }
コード例 #2
0
        public void InsertText(string textToInsert)
        {
            InsertTextAction action = new InsertTextAction(
                this, textToInsert, this.SelectionStart, this.SelectionLength);

            RunAction(action);

            //string oldText = this.Text;
            //this.BeforeTextChanged();
            //InsertTextCore(
            //    this,
            //    textToInsert,
            //    this.SelectionStart,
            //    this.SelectionLength);
            //this.AfterTextChanged();
            //RaiseTextChanged(oldText, this.Text);
        }
コード例 #3
0
        public void InsertText(string textToInsert)
        {
            InsertTextAction action = new InsertTextAction(
                this, textToInsert, this.SelectionStart, this.SelectionLength);

            RunAction(action);

            //string oldText = this.Text;
            //this.BeforeTextChanged();
            //InsertTextCore(
            //    this,
            //    textToInsert,
            //    this.SelectionStart,
            //    this.SelectionLength);
            //this.AfterTextChanged();
            //RaiseTextChanged(oldText, this.Text);
        }
コード例 #4
0
        public void SetText(string newValue)
        {
            if (newValue == Text || newValue == null)
            {
                return;
            }

            InsertTextAction action = new InsertTextAction(
                this, newValue, 0, this.TextLength);

            RunAction(action);

            //using (RedrawAccumulator a = new RedrawAccumulator(this.Root, options.Redraw))
            //{
            //    int oldCaretPosition = this.CaretPosition;
            //    this.Text = newValue;
            //    this.SetCaretPosition(oldCaretPosition);
            //}
        }
コード例 #5
0
        public void SetText(string newValue)
        {
            if (newValue == Text || newValue == null)
            {
                return;
            }

            InsertTextAction action = new InsertTextAction(
                this, newValue, 0, this.TextLength);

            RunAction(action);

            //using (RedrawAccumulator a = new RedrawAccumulator(this.Root, options.Redraw))
            //{
            //    int oldCaretPosition = this.CaretPosition;
            //    this.Text = newValue;
            //    this.SetCaretPosition(oldCaretPosition);
            //}
        }