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); } }
private void OnDocumentLoaded(PdfViewerException ex) { if (ex != null) { return; } try { controller.OpenOutlineItem(0); }catch (PdfNoFileOpenedException) { Logger.LogInfo("PdfNoFileOpenedException occured when trying to load outlines"); } }
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); } }
/// <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); } }
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); } }
protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex) { controller.OnOutlinesLoaded(ex, this.arguments, null); }
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); }
/// <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); } }
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 } }
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); }
protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex) { controller?.OnAnnotationsLoaded(ex, null); }
protected abstract void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex);
private void CloseCompletedEventHandler(PdfViewerException e) { thumbnailItemDict.Clear(); ThumbnailItemDictChanged(); InvalidateVisual(); }
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 } }
private void OnCloseCompletedEventHandler(PdfViewerException e) { clearRects(); selectedAnnotations.Clear(); //[InkingForPDF] }
private void OnCloseCompleted(PdfViewerException ex) { OutlineTreeView.Items.Clear(); InvalidateVisual(); }
protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex) { }
protected override void triggerControllerCallback(IPdfControllerCallbackManager controller, PdfViewerException ex) { controller.OnDrawCompleted(ex, null); }