Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// If name of one book is not available in the first (primary) writing system,
        /// the info in the next available (secondary) writing system is substituted.
        /// If not available in any given writing system, the 3-letter SIL/UBS book code is
        /// returned.
        /// </summary>
        /// <param name="fAvailable">Normally, the output array only includes available books
        /// if fAvailable is true.</param>
        /// <returns>An array of BookNameInfo objects in the requested primary writing system,
        /// as far as possible.</returns>
        /// ------------------------------------------------------------------------------------
        public override BookLabel[] GetBookNames(bool fAvailable)
        {
            // TODO: ToddJ (BryanW)	Implement the description above
            // foreach (int nEnc in m_requestedEncodings)
            // Assert that knEncSilCodes is in the list

            if (m_scripture == null)
            {
                return(null);
            }
            BookLabel[] rgblBookNames = new BookLabel[m_scripture.ScriptureBooksOS.Count];

            // for performance reasons, we assume that the books are fully cached. So
            // we temporary disable loading them from the database.
            FdoCache cache            = m_scripture.Cache;
            bool     fPrevPreloadData = cache.PreloadData;

            cache.PreloadData = false;

            for (int i = 0; i < m_scripture.ScriptureBooksOS.Count; i++)
            {
                ScrBook book      = (ScrBook)m_scripture.ScriptureBooksOS[i];
                string  sBookName = book.BestUIName;
                rgblBookNames[i] = new BookLabel(sBookName, (book.CanonicalNum));
            }

            cache.PreloadData = fPrevPreloadData;
            return(rgblBookNames);
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// If name of one book is not available in the first (primary) writing system,
        /// the info in the next available (secondary) writing system is substituted.
        /// If not available in any given writing system, the 3-letter SIL/UBS book code is
        /// returned.
        /// </summary>
        /// <param name="fAvailable">Normally, the output array only includes available books
        /// if fAvailable is true. Ignored in this implementation, since all names are
        /// returned.</param>
        /// <returns>An array of BookNameInfo objects in the requested primary writing system,
        /// as far as possible.</returns>
        /// ------------------------------------------------------------------------------------
        public virtual BookLabel[] GetBookNames(bool fAvailable)
        {
            // TODO: ToddJ (BryanW)	Implement the description above
            // foreach (int nEnc in m_requestedEncodings)
            // Assert that knWsSilCodes is in the list

            BookLabel[] rgblBookNames = new BookLabel[ScriptureBooksLim];
            WsNames     wsNames;

            if (PrimaryEncoding != 0)
            {
                wsNames = GetWsNames(PrimaryEncoding);
                if (wsNames != null)
                {
                    for (int i = 0; i < ScriptureBooksLim; i++)
                    {
                        rgblBookNames[i] = new BookLabel(wsNames.Name[i], (i + 1));
                    }

                    return(rgblBookNames);
                }
            }

            Debug.Assert(false);
            return(rgblBookNames);
        }
Пример #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// If name of one book is not available in the first (primary) writing system,
		/// the info in the next available (secondary) writing system is substituted.
		/// If not available in any given writing system, the 3-letter SIL/UBS book code is
		/// returned.
		/// </summary>
		/// <param name="fAvailable">Normally, the output array only includes available books
		/// if fAvailable is true.</param>
		/// <returns>An array of BookNameInfo objects in the requested primary writing system,
		/// as far as possible.</returns>
		/// ------------------------------------------------------------------------------------
		public override BookLabel[] GetBookNames(bool fAvailable)
		{
			// TODO: ToddJ (BryanW)	Implement the description above
			// foreach (int nEnc in m_requestedEncodings)
			// Assert that knEncSilCodes is in the list

			if (m_scripture == null)
				return null;
			BookLabel[] rgblBookNames = new BookLabel[m_scripture.ScriptureBooksOS.Count];

			// for performance reasons, we assume that the books are fully cached. So
			// we temporary disable loading them from the database.
			FdoCache cache = m_scripture.Cache;
			bool fPrevPreloadData = cache.PreloadData;
			cache.PreloadData = false;

			for (int i = 0; i < m_scripture.ScriptureBooksOS.Count; i++)
			{
				ScrBook book = (ScrBook)m_scripture.ScriptureBooksOS[i];
				string sBookName = book.BestUIName;
				rgblBookNames[i] = new BookLabel(sBookName, (book.CanonicalNum));
			}

			cache.PreloadData = fPrevPreloadData;
			return rgblBookNames;
		}