private void CalculateFigurePositions() { if (listOfFigures.Count == 0) { worker_RunWorkerCompleted(null, null); return; } PDFContentHelper pdfHelper = new PDFContentHelper(document.FileName); pdfHelper.LoadLayersFromDisk(document, -1); if (document.HasFigureLinks) { worker_RunWorkerCompleted(null, null); return; } index = 0; BackgroundWorker worker = new BackgroundWorker() { WorkerReportsProgress = true }; worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.RunWorkerAsync(); }
private void LoadDocument(TPadLocation newLocation) { if (newLocation.Document == null) throw new Exception("Document cannot be null"); if (!DbDocuments.ContainsKey(newLocation.Document.ID)) { Dispatcher.Invoke(DispatcherPriority.Render, (Action)delegate() { DocumentLoader loader = new DocumentLoader(); ActiveReaderDocument lookup = loader.LoadDocument(newLocation.Document); DbDocuments.Add(lookup.ID, lookup); }); } //1- Loads the layers should they exist in disk ActualDocument = DbDocuments[newLocation.Document.ID]; PdfHelper = new PDFContentHelper(ActualDocument.FileName); PdfHelper.LoadLayersFromDisk(ActualDocument, Core.Device.ID); //3- Load layers for current page ActualPage = newLocation.PageIndex; LoadLayersToPage(ActualDocument, ActualPage); }