GetBookFromBookInfo() public method

public GetBookFromBookInfo ( BookInfo bookInfo ) : Book.Book
bookInfo Bloom.Book.BookInfo
return Book.Book
        /// <summary>
        /// Called at idle time after everything else is set up, and only when this tab is visible
        /// </summary>
        private void ImproveAndRefreshBookButtons()
        {
            Button button;

            if (!_buttonsNeedingSlowUpdate.TryDequeue(out button))
            {
                return;
            }

            BookInfo bookInfo = button.Tag as BookInfo;

            Book.Book book;
            try
            {
                book = _model.GetBookFromBookInfo(bookInfo);
            }
            catch (Exception error)
            {
                //skip over the dependency injection layer
                if (error.Source == "Autofac" && error.InnerException != null)
                {
                    error = error.InnerException;
                }
                Logger.WriteEvent("There was a problem with the book at " + bookInfo.FolderPath + ". " + error.Message);
                if (!_alreadyReportedErrorDuringImproveAndRefreshBookButtons)
                {
                    _alreadyReportedErrorDuringImproveAndRefreshBookButtons = true;
                    Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error, "There was a problem with the book at {0}. \r\n\r\nClick the 'Details' button for more information.\r\n\r\nThis error may effect other books, but this is the only notice you will receive.\r\n\r\nSee 'Help:Show Event Log' for any further errors.", bookInfo.FolderPath);
                }
                return;
            }

            //Only go looking for a better title if the book hasn't already been localized when we first showed it.
            //The idea is, if we already have a localization mapping for this name, then
            // we're not going to get a better title by digging into the document itself and overriding what the localizer
            // chose to call it.
            // Note: currently (August 2014) the books that will have been localized are are those in the main "templates" section: Basic Book, Calendar, etc.
            if (button.Text == ShortenTitleIfNeeded(bookInfo.QuickTitleUserDisplay))
            {
                var titleBestForUserDisplay = ShortenTitleIfNeeded(book.TitleBestForUserDisplay);
                if (titleBestForUserDisplay != button.Text)
                {
                    Debug.WriteLine(button.Text + " --> " + titleBestForUserDisplay);
                    button.Text = titleBestForUserDisplay;
                }
            }
            if (button.ImageIndex == 999)          //!bookInfo.TryGetPremadeThumbnail(out unusedImage))
            {
                ScheduleRefreshOfOneThumbnail(book);
            }
        }
        /// <summary>
        /// Called at idle time after everything else is set up, and only when this tab is visible
        /// </summary>
        private void ImproveAndRefreshBookButtons()
        {
            Button button;

            if (!_buttonsNeedingSlowUpdate.TryDequeue(out button))
            {
                return;
            }

            BookInfo bookInfo = button.Tag as BookInfo;

            Book.Book book;
            try
            {
                book = _model.GetBookFromBookInfo(bookInfo);
            }
            catch (Exception error)
            {
                //skip over the dependency injection layer
                if (error.Source == "Autofac" && error.InnerException != null)
                {
                    error = error.InnerException;
                }
                Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error, "There was a problem with the book at " + bookInfo.FolderPath);
                return;
            }

            var titleBestForUserDisplay = ShortenTitleIfNeeded(book.TitleBestForUserDisplay);

            if (titleBestForUserDisplay != button.Text)
            {
                Debug.WriteLine(button.Text + " --> " + titleBestForUserDisplay);
                button.Text = titleBestForUserDisplay;
            }
            if (button.ImageIndex == 999)          //!bookInfo.TryGetPremadeThumbnail(out unusedImage))
            {
                ScheduleRefreshOfOneThumbnail(book);
            }
        }