public void CollapseAllAnnotations(IVwRootBox rootbox)
{
// Make a copy of the table (since collapsing causes keys to be deleted from the table
// and we are enumerating through it).
Dictionary<int, bool> expandTable = new Dictionary<int, bool>(m_expandTable);
var annotationRepo = m_cache.ServiceLocator.GetInstance <IScrScriptureNoteRepository>();
IScrScriptureNote ann;
foreach (int annHvo in expandTable.Keys)
{
// Confirm that the object is an annotation because we only want to collapse at
// the annotation level so that we can maintain the expansion status of the
// fields within the annotation.
if (annotationRepo.TryGetObject(annHvo, out ann) && IsExpanded(annHvo))
ToggleItemExpansion(annHvo, rootbox);
}
}