public bool OnFileExportOXESA(object args)
{
CheckDisposed();
XmlScrAnnotationsList list = new XmlScrAnnotationsList(Cache);
// need to use the dataAccess from the rootbox to get the filtered list - TE-9277
var dataAccess = m_dataEntryView.RootBox.DataAccess;
foreach (IScrBookAnnotations annotations in m_scr.BookAnnotationsOS)
{
List<IScrScriptureNote> notesToExport = new List<IScrScriptureNote>();
// TE-9371: Changed way to get hvo's of filtered notes to improve performance
int arraySize = dataAccess.get_VecSize(annotations.Hvo, ScrBookAnnotationsTags.kflidNotes);
int[] itemHvos;
using (var arrayPtr = MarshalEx.ArrayToNative<int>(arraySize))
{
int chvo;
dataAccess.VecProp(annotations.Hvo, ScrBookAnnotationsTags.kflidNotes, arraySize, out chvo, arrayPtr);
itemHvos = MarshalEx.NativeToArray<int>(arrayPtr, chvo);
}
foreach (int hvo in itemHvos)
{
IScrScriptureNote note =
Cache.ServiceLocator.GetInstance<IScrScriptureNoteRepository>().GetObject(hvo);
if (note.AnnotationTypeRA.Guid == CmAnnotationDefnTags.kguidAnnTranslatorNote ||
note.AnnotationTypeRA.Guid == CmAnnotationDefnTags.kguidAnnConsultantNote)
{
// When we are exporting only notes, we only want to export notes that
// are translator notes or consultant notes (i.e. no checking error notes).
notesToExport.Add(note);
}
}
list.Add(notesToExport);
}
using (TeImportExportFileDialog dlg = new TeImportExportFileDialog(Cache.ProjectId.Name, FileType.OXESA))
{
// TODO: Need to supply a decent default filename. Should it include
// a date/time to avoid accidental overwriting?
if (dlg.ShowSaveDialog(null, this) == DialogResult.OK)
list.SerializeToFile(dlg.FileName);
}
return true;
}