public bool TryGetPencil(int timeoutMilliseconds, out TextPencil pencil)
        {
            if (!this.pencilEvent.WaitOne(timeoutMilliseconds))
            {
                pencil = null;
                return false;
            }

            this.activePencil = new Pencil(this, forUndoRedo: false);
            pencil = this.activePencil;
            return true;
        }
 public void Redo(TextPencil pencil)
 {
     if (this.changes != null)
     {
         // Changes get redone in original order
         for (int i = 0; i < this.changes.Count; i++)
         {
             var change = this.changes[i];
             pencil.Write(change.Start, change.OldEnd, change.Replacement);
         }
     }
 }
 public void Undo(TextPencil pencil)
 {
     if (this.changes != null)
     {
         // Changes get undone in reverse order
         for (int i = this.changes.Count - 1; i >= 0; i--)
         {
             var change = this.changes[i];
             pencil.Write(change.Start, change.NewEnd, change.OldTextData.GetSubrange(change.Start, change.OldEnd));
         }
     }
 }
Beispiel #4
0
        public bool TryGetPencil(int timeoutMilliseconds, out TextPencil pencil)
        {
            if (!this.pencilEvent.WaitOne(timeoutMilliseconds))
            {
                pencil = null;
                return(false);
            }

            this.activePencil = new Pencil(this, forUndoRedo: false);
            pencil            = this.activePencil;
            return(true);
        }
 public void Redo(TextPencil pencil)
 {
     if (this.changes != null)
     {
         // Changes get redone in original order
         for (int i = 0; i < this.changes.Count; i++)
         {
             var change = this.changes[i];
             pencil.Write(change.Start, change.OldEnd, change.Replacement);
         }
     }
 }
 public void Undo(TextPencil pencil)
 {
     if (this.changes != null)
     {
         // Changes get undone in reverse order
         for (int i = this.changes.Count - 1; i >= 0; i--)
         {
             var change = this.changes[i];
             pencil.Write(change.Start, change.NewEnd, change.OldTextData.GetSubrange(change.Start, change.OldEnd));
         }
     }
 }
 public bool TryGetPencil(out TextPencil pencil)
 {
     return TryGetPencil(DefaultGetPencilTimeout, out pencil);
 }
Beispiel #8
0
 public bool TryGetPencil(out TextPencil pencil)
 {
     return(TryGetPencil(DefaultGetPencilTimeout, out pencil));
 }