private void GetThumbNailOfBookCover(Book.Book book, HtmlThumbNailer.ThumbnailOptions thumbnailOptions, Action <Image> callback, Action <Exception> errorCallback, bool async) { if (book is ErrorBook) { callback(Resources.Error70x70); return; } try { if (book.HasFatalError) //NB: we might not know yet... we don't fully load every book just to show its thumbnail { callback(Resources.Error70x70); return; } GenerateImageForWeb(book); Image thumb; if (book.Storage.TryGetPremadeThumbnail(thumbnailOptions.FileName, out thumb)) { callback(thumb); return; } #if USE_HTMLTHUMBNAILER_FOR_COVER var dom = book.GetPreviewXmlDocumentForFirstPage(); if (dom == null) { callback(Resources.Error70x70); return; } string folderForCachingThumbnail; folderForCachingThumbnail = book.StoragePageFolder; _thumbnailProvider.GetThumbnail(folderForCachingThumbnail, book.Storage.Key, dom, thumbnailOptions, callback, errorCallback, async); #else if (!CreateThumbnailOfCoverImage(book, thumbnailOptions, callback)) { callback(Resources.Error70x70); } #endif } catch (Exception err) { callback(Resources.Error70x70); errorCallback(err); Debug.Fail(err.Message); } }
public void GetThumbNailOfBookCover(Book.Book book, HtmlThumbNailer.ThumbnailOptions thumbnailOptions, Action <Image> callback, Action <Exception> errorCallback, bool async) { if (book is ErrorBook) { callback(Resources.Error70x70); return; } try { if (book.HasFatalError) //NB: we might not know yet... we don't fully load every book just to show its thumbnail { callback(Resources.Error70x70); return; } Image thumb; if (book.Storage.TryGetPremadeThumbnail(thumbnailOptions.FileName, out thumb)) { callback(thumb); return; } var dom = book.GetPreviewXmlDocumentForFirstPage(); if (dom == null) { callback(Resources.Error70x70); return; } string folderForCachingThumbnail; folderForCachingThumbnail = book.Storage.FolderPath; _thumbnailProvider.GetThumbnail(folderForCachingThumbnail, book.Storage.Key, dom, thumbnailOptions, callback, errorCallback, async); } catch (Exception err) { callback(Resources.Error70x70); Debug.Fail(err.Message); } }