public void Collect()
{
while (this._markerStack.Count > 0)
{
DropMarker dm = this._markerStack.Pop();
// If the Drop Marker was deleted in the document by
// a user action it will be disposed but not removed
// from the marker stack. In this case just pretend
// like it doesn't exist and go on to the next one
if (dm.IsDisposed)
continue;
// The MarkerCollection fires a cancellable event.
// If it is canclled the Collect() method will return
// false. In this case we need to push the marker back
// on the stack so that it will still be collected in
// the future.
if (!dm.Collect())
this._markerStack.Push(dm);
return;
}
}