/// ------------------------------------------------------------------------------------ /// <summary> /// Initialize a list of book names available from the import file list. /// </summary> /// <returns>the number of books available for import</returns> /// ------------------------------------------------------------------------------------ private int InitBookNameList() { List<int> booksPresent = null; try { booksPresent = m_importSettings.BooksForProject(); } catch { // TODO: Add a message to tell the user that the paratext project could // not be loaded. } if (booksPresent == null || booksPresent.Count == 0) { // This can probably only happen in the weird case where a Paratext project // that previously had books now has none. radImportRange.Enabled = scrPsgFrom.Enabled = scrPsgTo.Enabled = false; return 0; } radImportRange.Enabled = true; scrPsgFrom.Enabled = scrPsgTo.Enabled = radImportRange.Checked; MultilingScrBooks mlBook = new MultilingScrBooks((IScrProjMetaDataProvider)m_scr); // Get list of books in import files BookLabel[] bookNames = new BookLabel[booksPresent.Count]; int iName = 0; foreach (int bookOrd in booksPresent) bookNames[iName++] = new BookLabel(mlBook.GetBookName(bookOrd), bookOrd); scrPsgFrom.BookLabels = bookNames; scrPsgTo.BookLabels = bookNames; return bookNames.Length; }