Exemplo n.º 1
0
        private void OnOpenCompletedEventHandler(PdfViewerException exception)
        {
            if (exception == null)
            {
                return;
            }

            Logger.LogException(exception);
            if (exception is PdfLicenseInvalidException)
            {
                if (TryObtainValidLicense((PdfLicenseInvalidException)exception))
                {
                    OpenFile(filename, password);
                }
            }
            else if (exception is PdfFileNotFoundException)
            {
                MessageBox.Show("File \"" + filename + "\" was not found.");
            }
            else if (exception is PdfPasswordException)
            {
                PasswordWindow passwordWindow = new PasswordWindow();
                this.Focus();
                if (passwordWindow.ShowDialog() != true)
                {
                    return;
                }
                OpenFile(filename, passwordWindow.Password);
            }
            else if (exception is PdfFileCorruptException)
            {
                MessageBox.Show("The opened file \"" + filename + "\" is not a pdf file or is corrupt:\n" + exception.Message);
                Logger.LogException(exception);
            }
            else if (exception is PdfUnsupportedFeatureException)
            {
                MessageBox.Show("The opened file \"" + filename + "\" uses features that are not supported by the rendering engine:\n" + exception.Message);
                Logger.LogException(exception);
            }
            else if (exception is PdfNoFileOpenedException)
            {
                MessageBox.Show("The Application closed the file before opening could complete");
                Logger.LogException(exception);
            }
            else
            {
                MessageBox.Show("An unexpected Exception occured: \"" + exception.Message + "\" " + exception.ToString(), "Exception");
                Logger.LogException(exception);
            }
        }
Exemplo n.º 2
0
 private void OnDocumentLoaded(PdfViewerException ex)
 {
     if (ex != null)
     {
         return;
     }
     try
     {
         controller.OpenOutlineItem(0);
     }catch (PdfNoFileOpenedException)
     {
         Logger.LogInfo("PdfNoFileOpenedException occured when trying to load outlines");
     }
 }
Exemplo n.º 3
0
        private void OnOpenCompletedEventHandler(PdfViewerException e)
        {
            if (e != null)
            {
                return;
            }

            thumbnailItemDict.Clear();
            int NoOfThumbnails = Math.Min(controller.PageCount, 5);

            for (int i = 0; i < NoOfThumbnails; i++)
            {
                ThumbnailItem item = new ThumbnailItem(i + 1, NoOfThumbnails, controller, SetSelection, ScrollElementIntoView);
                item.Update();
                thumbnailItemDict.Add(i + 1, item);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Trigger the event and release one waiting thread, passing an argument
 /// </summary>
 /// <param name="argument">The argument to pass to the waiting thread</param>
 /// <param name="ex">The exception that occured in the triggering thread</param>
 public void TriggerEvent(T argument, PdfViewerException ex)
 {
     this.argument = argument;
     if (ex != null)
     {
         Logger.LogException(ex, 1);
         this.ex = ex;
     }
     try
     {
         sem.Release();
     }
     catch (SemaphoreFullException)
     {
         return;
     }
     if (Completed != null)
     {
         Completed(argument, ex);
     }
 }
Exemplo n.º 5
0
        public void TriggerEvent(PdfViewerException ex)
        {
            if (ex == null)
            {
                ex = new PdfViewerException("PdfEvent.TriggerEvent(ex) cannot be called with null");
                Logger.LogException(ex, 1);
            }
            this.ex = ex;
            try
            {
                sem.Release();
            }
            catch (SemaphoreFullException)
            {
                return;
            }

            if (Completed != null)
            {
                Completed(argument, ex);
            }
        }
Exemplo n.º 6
0
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex)
 {
     controller.OnOutlinesLoaded(ex, this.arguments, null);
 }
Exemplo n.º 7
0
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, InOutTuple tuple, PdfViewerException ex)
 {
     controller.OnOutlinesLoaded(ex, tuple.arguments, tuple.output);
 }
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex)
 {
     controller.OnThumbnailLoaded(this.arguments.page, null, ex);
 }
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, InOutTuple tuple, PdfViewerException ex)
 {
     controller.OnThumbnailLoaded(tuple.arguments.page, tuple.output, ex);
 }
Exemplo n.º 10
0
        /// <summary>
        /// When controller loaded new outlineItems, add them to the existing treeView or replace it if parentId == 0
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="outlineItems"></param>
        /// <param name="ex"></param>
        private void OnOutlineItemsLoaded(int parentId, IList <PdfOutlineItem> outlineItems, PdfViewerException ex)
        {
            if (ex != null)
            {
                if (ex is PdfNoFileOpenedException)
                {
                    OnCloseCompleted(null);
                    return;
                }
                throw new NotImplementedException();
            }

            if (parentId == 0)
            {
                if (outlineItems == null)
                {
                    return;
                }
                OutlineTreeView.Items.Clear();
                IEnumerator <PdfOutlineItem> enumerator = outlineItems.GetEnumerator();
                enumerator.MoveNext();
                recursivelyAddOutlines(OutlineTreeView, enumerator);
                InvalidateVisual();
            }
            else
            {
                IEnumerator <PdfOutlineItem> enumerator = outlineItems.GetEnumerator();
                enumerator.MoveNext();
                bool success = recursivelySearchForParentToAddOutlines(OutlineTreeView, parentId, enumerator);
            }
        }
Exemplo n.º 11
0
 private void OnOpenCompletedEventHandler(APdfRequest <OpenArguments, object> .InOutTuple o, PdfViewerException ex)
 {
     if (ex == null)
     {
         // Default page order - normal behaviour
         _pageOrder       = new List <int>(Enumerable.Range(1, document.PageCount));
         InversePageOrder = _pageOrder;
     }
     else
     {
         // opening request failed doing nothing
     }
 }
Exemplo n.º 12
0
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex)
 {
     throw new NotImplementedException("This should not be called because APdfRequest.Execute has been overridden");
 }
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex)
 {
     controller.OnAnnotationUpdate(ex, new List <int>()
     {
         -1
     });
 }
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, InOutTuple tuple, PdfViewerException ex)
 {
     controller.OnAnnotationUpdate(ex, tuple.output);
 }
Exemplo n.º 15
0
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex)
 {
     controller?.OnAnnotationsLoaded(ex, null);
 }
Exemplo n.º 16
0
 protected abstract void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex);
Exemplo n.º 17
0
 private void CloseCompletedEventHandler(PdfViewerException e)
 {
     thumbnailItemDict.Clear();
     ThumbnailItemDictChanged();
     InvalidateVisual();
 }
Exemplo n.º 18
0
 private void OnCloseCompletedEventHandler(APdfRequest <bool, object> .InOutTuple o, PdfViewerException ex)
 {
     if (ex == null)
     {
         // invalidate caches
         pageCache.InvalidateCache();
         textFragmentCache.InvalidateCache();
         thumbnailCache.InvalidateCache();
     }
     else
     {
         // closing failed. keep caches
     }
 }
Exemplo n.º 19
0
 private void OnCloseCompletedEventHandler(PdfViewerException e)
 {
     clearRects();
     selectedAnnotations.Clear(); //[InkingForPDF]
 }
Exemplo n.º 20
0
 private void OnCloseCompleted(PdfViewerException ex)
 {
     OutlineTreeView.Items.Clear();
     InvalidateVisual();
 }
Exemplo n.º 21
0
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex)
 {
 }
Exemplo n.º 22
0
 protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex)
 {
     controller.OnDrawCompleted(ex, null);
 }