Beispiel #1
0
        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();
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            //Saves the calculated figures
              PDFContentHelper pdfHelper = new PDFContentHelper(document.FileName);
              pdfHelper.SaveLayersToDisk(document, -1);

              //Closes the splash
              //splash.Close();
        }
Beispiel #4
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

              PDFContentHelper pdfHelper = new PDFContentHelper(document.FileName);
              //Search for the term "figure" in document
              foreach (Figure figure in listOfFigures)
              {
            List<ContentLocation> linksForFigure = pdfHelper.ContentToPixel(figure.TriggerText[1], -1, document.DocumentSize.Width, document.DocumentSize.Height);
            worker.ReportProgress(++index * 100 / listOfFigures.Count, new Object[] { figure, linksForFigure });
            //worker.ReportProgress(++index * 100 / listOfFigures.Count, new Object[] { figure, new List<ContentLocation>() });
              }
        }