Ejemplo n.º 1
0
        private void ImportPage(ILibrary libManager, BookViewModel parent, PageViewModel page)
        {
            PageDao pageDao = new PageDao();

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

            libManager.AccessDispatcherObject(() => parent.AddPage(page));
        }
Ejemplo n.º 2
0
        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);
                }
            });
        }
Ejemplo n.º 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);
            }));
        }