Alsing.SourceCode.UndoBlockCollection.Add C# (CSharp) Метод

Add() публичный Метод

public Add ( UndoBlock item ) : int
item UndoBlock
Результат int
        public int Add(UndoBlock item)
        {
            if (NeedsGrowth())
                Grow();

            ++m_version;
            m_array[m_count] = item;

            return m_count++;
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Outdent the active selection one step
        /// </summary>
        public void Outdent(string Pattern)
        {
            if (!IsValid)
                return;

            Row xtr = null;
            var ActionGroup = new UndoBlockCollection();
            for (int i = LogicalBounds.FirstRow;
                 i <=
                 LogicalBounds.LastRow;
                 i++)
            {
                xtr = Control.Document[i];
                var b = new UndoBlock();
                b.Action = UndoAction.DeleteRange;
                b.Position.X = 0;
                b.Position.Y = i;
                ActionGroup.Add(b);
                string s = xtr.Text;
                if (s.StartsWith(Pattern))
                {
                    b.Text = s.Substring(0, Pattern.Length);
                    s = s.Substring(Pattern.Length);
                }
                xtr.Text = s;
            }
            if (ActionGroup.Count > 0)
                Control.Document.AddToUndoList(ActionGroup);
            Bounds = LogicalBounds;
            Bounds.FirstColumn = 0;
            Bounds.LastColumn = xtr.Text.Length;
            Control.Caret.Position.X = LogicalBounds.LastColumn;
            Control.Caret.Position.Y = LogicalBounds.LastRow;
        }
All Usage Examples Of Alsing.SourceCode.UndoBlockCollection::Add