Пример #1
0
 public override void DidChangeAnnotation(PSPDFAnnotation annotation, PSPDFAnnotation originalAnnotation, NSArray keyPaths, NSDictionary options)
 {
     if (annotation is IKSAnnotation)
     {
         Console.WriteLine("Custom annotation changed: " + annotation);
     }
 }
 public override bool DidTapOnAnnotation(PSPDFViewController pdfController, PSPDFAnnotation annotation, System.Drawing.PointF annotationPoint, PSPDFAnnotationViewProtocol annotationView, PSPDFPageView pageView, System.Drawing.PointF viewPoint)
 {
     if (annotation is PSPDFLinkAnnotation)
     {
         var linkAnnot = (PSPDFLinkAnnotation)annotation;
         Console.WriteLine("Tapped a link annotation!");
         var alert = new UIAlertView("TapTap", "Tapped link annotation. Target: " + linkAnnot.SiteLinkTarget, null, null, "OK");
         alert.Show();
         return(true);
     }
     return(false);
 }
 public KSAnnotationElement(PSPDFAnnotation annot) : base("")
 {
     this.annot    = annot;
     this.oImgIcon = new UIImage();
 }
 public CustomNoteAnnotationController(PSPDFAnnotation annot, bool bAllowEditing) : base(annot, bAllowEditing)
 {
     Console.WriteLine("*** CustomNoteAnnotationController(PSPDFDocumentProvider)");
 }
        private void PopulateAnnotationSource()
        {
            List <Section> sections = new List <Section> ();

            //Thread.Sleep (6000);
            //For every page get custom annotations and add to source
            for (uint page = 0; page < this.document.PageCount; page++)
            {
                List <PSPDFAnnotation> annots = new List <PSPDFAnnotation> ();

                var annotsForPage = this.document.AnnotationParser.FileAnnotationProvider.AnnotationsForPage(page);

                if (annotsForPage.Length < 1)
                {
                    continue;
                }

                //loop and add only custom
                foreach (var annot in annotsForPage)
                {
                    if (!(annot is IKSAnnotation))
                    {
                        //Only want annotations we made ..
                        continue;
                    }

                    annots.Add(annot);
                }

                if (annots.Count < 1)
                {
                    //no point continuing
                    continue;
                }

                //Sort by Type
                annots.Sort((x, y) =>
                {
                    //Sort by Page and then Type
                    return(String.Compare(x.TypeString, y.TypeString));
                });


                //Create Sections
                Section section = new Section("Page " + (page + 1).ToString());
                sections.Add(section);
                foreach (var annot in annots)
                {
                    PSPDFAnnotation annotCapture = annot;
                    var             tabElem      = new KSAnnotationElement(annot);
                    tabElem.Tapped += () =>
                    {
                        this.controller.SetPageAnimated(annotCapture.Page, true);

                        //Close Modal
                        this.controller.PopoverController.Dismiss(true);
                        this.controller.PopoverController = null;
                    };


                    section.Add(tabElem);
                }
            }

            //Now Completed , Now Remove the Activity Indicator and load the sections
            InvokeOnMainThread(() =>
            {
                //Remove Activity Indicator
                this.Root.Remove(this.Root.ElementAt(0), UITableViewRowAnimation.Automatic);

                //Insert Sections (Pages number with Annotations)
                this.Root.Insert(0, UITableViewRowAnimation.Bottom, sections.ToArray());
            });
        }