示例#1
0
        protected void GenerateDeliverables(DataOperationUnit dataOpUnit)
        {
            BookFacade.GetProeprty(ref _book, dataOpUnit);

            if (_book.FirstPage != null && !_book.FirstPage.Image.ThumbnailLoaded || !_book.FirstPage.Image.ThumbnailGenerated)
            {
                ThumbnailGenerating.GenerateThumbnail(_book.FirstPage.Image);
            }
        }
示例#2
0
 private void PrepareThumbnailIfFirstPage(ILibrary libManager, BookViewModel parent, PageViewModel page)
 {
     if (page.PageIndex == Specifications.PAGEINDEX_FIRSTPAGE)
     {
         ThumbnailGenerating.GenerateThumbnail(page.Image, _dataOpUnit);
         libManager.AccessDispatcherObject(() => parent.FirstPage = page);
         libManager.AccessDispatcherObject(() => parent.IsLoaded  = true);
     }
 }
 public override void ConfigureTaskImplementation(AsyncTaskSequence sequence)
 {
     foreach (var page in TargetPages)
     {
         ImageViewModel image = page.Image;
         sequence.Add(new Task(() => Delete.ThumbnailDeleting.DeleteThumbnail(image)));
         sequence.Add(new Task(() => ThumbnailGenerating.GenerateThumbnail(image)));
         sequence.Add(new Task(() => s_logger.Info($"Remade Thumbnail imageId:{image.ID}")));
     }
 }
示例#4
0
 private static void GenerateThumbnailIf(PageViewModel page)
 {
     if (page.Image != null)
     {
         if (!page.Image.ThumbnailLoaded || !page.Image.ThumbnailGenerated)
         {
             ThumbnailGenerating.GenerateThumbnail(page.Image);
         }
     }
 }
        public static List <Task> GenerateRemakeThumbnailTasks(IEnumerable <PageViewModel> pages)
        {
            List <Task> tasks = new List <Task>();

            foreach (var page in pages)
            {
                ImageViewModel image = page.Image;
                tasks.Add(new Task(() => Delete.ThumbnailDeleting.DeleteThumbnail(image)));
                tasks.Add(new Task(() => ThumbnailGenerating.GenerateThumbnail(image)));
                tasks.Add(new Task(() => s_logger.Info($"Remade Thumbnail imageId:{image.ID}")));
            }

            return(tasks);
        }
        public override void ConfigureTaskImplementation(AsyncTaskSequence sequence)
        {
            foreach (var book in TargetBooks)
            {
                if (book.FirstPage == null)
                {
                    continue;
                }

                ImageViewModel image = book.FirstPage.Image;
                sequence.Add(new Task(() => Delete.ThumbnailDeleting.DeleteThumbnail(image)));
                sequence.Add(new Task(() => ThumbnailGenerating.GenerateThumbnail(image)));
                sequence.Add(new Task(() => s_logger.Info($"Remade Thumbnail imageId:{image.ID}")));
            }
        }
示例#7
0
        private static void CreateEntities(ILibrary _libraryVM, PageViewModel _page, CoverSegmenting cs, DataOperationUnit dataOpUnit)
        {
            Guid imageID = Guid.NewGuid();
            var  image   = new ImageViewModel(imageID, "cover", cs._masterPath, Configuration.ApplicationConfiguration);

            image.Configuration  = Configuration.ApplicationConfiguration;
            image.ID             = imageID;
            image.UnescapedTitle = "cover";
            if (System.IO.Path.IsPathRooted(cs._masterPath))
            {
                image.RelativeMasterPath = ImageViewModel.MakeRelativeMasterPath(Configuration.ApplicationConfiguration.WorkingDirectory, cs._masterPath);
            }
            else
            {
                image.RelativeMasterPath = cs._masterPath;
            }
            ImageFacade.Insert(image, dataOpUnit);

            var pageID = Guid.NewGuid();
            var page   = new PageViewModel();

            page.Configuration  = Configuration.ApplicationConfiguration;
            page.ID             = pageID;
            page.UnescapedTitle = "cover";
            page.ImageID        = imageID;
            page.BookID         = _page.BookID;
            page.PageIndex      = 1;
            page.Image          = image;
            PageFacade.Insert(page, dataOpUnit);

            var book = _libraryVM.OnStage.Where(b => b.ID.Equals(_page.BookID)).Single();

            book.FirstPage = page;
            if (book.FirstPage.Image.ThumbnailRecorded)
            {
                book.FirstPage.Image.Thumbnail = ThumbnailFacade.FindByImageID(book.FirstPage.ImageID, dataOpUnit);
            }

            if (!book.FirstPage.Image.ThumbnailLoaded || !book.FirstPage.Image.ThumbnailGenerated)
            {
                ThumbnailGenerating.GenerateThumbnail(book.FirstPage.Image, dataOpUnit);
            }

            cs._book = book;
        }
        public static List <Task> GenerateRemakeThumbnailTasks(IEnumerable <BookViewModel> books)
        {
            List <Task> tasks = new List <Task>();

            foreach (var book in books)
            {
                if (book.FirstPage == null)
                {
                    continue;
                }

                ImageViewModel image = book.FirstPage.Image;
                tasks.Add(new Task(() => Delete.ThumbnailDeleting.DeleteThumbnail(image)));
                tasks.Add(new Task(() => ThumbnailGenerating.GenerateThumbnail(image)));
                tasks.Add(new Task(() => s_logger.Info($"Remade Thumbnail imageId:{image.ID}")));
            }

            return(tasks);
        }
示例#9
0
        public static void GenerateThumbnailIf(BookViewModel book, DataOperationUnit dataOpUnit = null)
        {
            var firstPage = book.FirstPage;

            if (firstPage != null)
            {
                var firstPageImage = firstPage.Image;

                if (!firstPageImage.ThumbnailLoaded)
                {
                    firstPageImage.Thumbnail = ThumbnailFacade.FindByImageID(firstPageImage.ID, dataOpUnit);
                }

                if (!firstPageImage.ThumbnailLoaded ||
                    firstPageImage.Thumbnail?.RelativeMasterPath == null ||
                    !firstPageImage.ThumbnailGenerated)
                {
                    ThumbnailGenerating.GenerateThumbnail(firstPageImage, dataOpUnit);
                }
            }
        }