private void ImportPage(ILibrary libManager, BookViewModel parent, PageViewModel page)
        {
            PageDao pageDao = new PageDao();

            pageDao.Insert(page.ToEntity(), _dataOpUnit.CurrentConnection);

            libManager.AccessDispatcherObject(() => parent.AddPage(page));
        }
        public static void FillContents(IBookStorage bookStorage, BookViewModel book)
        {
            var pages = PageFacade.FindByBookId(book.ID).OrderBy(p => p.PageIndex);

            bookStorage.AccessDispatcherObject(() => book.ClearContents());

            bookStorage.AccessDispatcherObject(() =>
            {
                foreach (var page in pages)
                {
                    book.AddPage(page);
                }
            });
        }
Exemple #3
0
        private void ProcessChildren(ILibrary library, List <Task> ret, string directoryPath, Importer child, DataOperationUnit dataOpUnit, Action <Importer, BookViewModel> progressUpdatingAction)
        {
            if (child is ImportPage)
            {
                var ip = child as ImportPage;
                ip.PageIndex      = Processed + Specifications.PAGEINDEX_FIRSTPAGE;
                ip.TotalPageCount = _children.Count();
                ip.PageTitle      = child.Name;
            }
            var tasks = child.GenerateTasks(library, directoryPath, System.IO.Path.GetFileNameWithoutExtension(child.Path), dataOpUnit, progressUpdatingAction);

            ret.AddRange(tasks);
            if (child is ImportPage)
            {
                var ip = child as ImportPage;
                ret.Add(new Task(() => library.AccessDispatcherObject(() => _book.AddPage(ip.GeneratedPage))));
            }
            ret.Add(new Task(() =>
            {
                ++Processed;
                progressUpdatingAction.Invoke(this, _book);
            }));
        }