public void ClearDocument()
 {
     if (Link != null)
     {
         Link.StopPageBuilding();
         Link.Dispose();
         linkCore = null;
     }
 }
Esempio n. 2
0
        public void TestTemplatedLink()
        {
            var link = new TemplatedLink <OperationResponse>(
                "https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/operations{?cursor,limit,order}");

            Assert.AreEqual("horizon.stellar.org", link.Uri.Host);
            Assert.AreEqual("/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/operations",
                            string.Concat(link.Uri.Segments));
        }
 public void CreateDocument()
 {
     if (Link == null)
     {
         Link = CreateLink();
         Link.PrintingSystem.PageSettingsChanged += OnPageSettingsChanged;
     }
     ProcessLink(Link);
     Link.CreateDocument(true);
 }
Esempio n. 4
0
        protected override void ProcessLink(TemplatedLink link)
        {
            IsRepeatHeaderEveryPageEnabled = !(PageBreakAfter || KeepTogether);
            IsPageBreakAfterEnabled        = !RepeatHeaderEveryPage;
            IsKeepTogetherEnabled          = !RepeatHeaderEveryPage;
            CollectionViewLink collectionViewLink = (CollectionViewLink)link;

            collectionViewLink.GroupInfos[0].Union = KeepTogether ? GroupUnion.WholePage : GroupUnion.None;
            collectionViewLink.GroupInfos[0].RepeatHeaderEveryPage = RepeatHeaderEveryPage;
            collectionViewLink.GroupInfos[0].PageBreakAfter        = PageBreakAfter;
        }
Esempio n. 5
0
        public void TestTemplatedLinkWithVariable()
        {
            var link = new TemplatedLink <AccountDataResponse>(
                "https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/data/{key}");

            var uri = link.Resolve(new
            {
                key = "foobar"
            });

            Assert.AreEqual("https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/data/foobar",
                            uri.ToString());
        }
Esempio n. 6
0
        public void TestTemplatedLinkWithQueryParameters()
        {
            var link = new TemplatedLink <OperationResponse>(
                "https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7/operations{?cursor,limit,order}");
            var uri = link.Resolve(new
            {
                limit  = 10,
                order  = OrderDirection.DESC,
                cursor = "now"
            });

            var query = HttpUtility.ParseQueryString(uri.Query);

            Assert.AreEqual("10", query["limit"]);
            Assert.AreEqual("desc", query["order"]);
            Assert.AreEqual("now", query["cursor"]);
        }
Esempio n. 7
0
        protected override void ProcessLink(TemplatedLink link)
        {
            ((SimpleLink)link).ColumnLayout = GetColumnLayout();
            ClearPageHeaderFooter();
            DataTemplate template = PageNumberTemplate;

            switch (PageNumberLocation)
            {
            case PageNumberLocation.TopMargin:
                link.TopMarginTemplate = template;
                link.TopMarginData     = GetPageNumberDataContext();
                break;

            case PageNumberLocation.BottomMargin:
                link.BottomMarginTemplate = template;
                link.BottomMarginData     = GetPageNumberDataContext();
                break;
            }
        }
 static HypermediaProcessorBase()
 {
     MulticastObject
     .ImplementationOf <IApiDocumentation>()
     .ForFunction(_ => _.GetEntryPoint())
     .ImplementedBy(_ => ApiDocumentation.GetEntryPoint(_));
     MulticastObject
     .ImplementationOf <IApiDocumentation>()
     .ForFunction(_ => _.GetEntryPoint(CancellationToken.None))
     .ImplementedBy(_ => ApiDocumentation.GetEntryPoint(_, CancellationToken.None));
     MulticastObject
     .ImplementationOf <ICollection>()
     .ForFunction(_ => _.GetIterator())
     .ImplementedBy(_ => Collection.GetIterator(_));
     MulticastObject
     .ImplementationOf <ITemplatedLink>()
     .ForFunction(_ => _.ExpandTarget((IDictionary <string, string>)null))
     .ImplementedBy(_ => TemplatedLink.ExpandTarget(_, (IDictionary <string, string>)null));
     MulticastObject
     .ImplementationOf <ITemplatedLink>()
     .ForFunction(_ => _.ExpandTarget((Action <MappingsBuilder>)null))
     .ImplementedBy(_ => TemplatedLink.ExpandTarget(_, (Action <MappingsBuilder>)null));
     MulticastObject
     .ImplementationOf <ITemplatedOperation>()
     .ForFunction(_ => _.ExpandTarget((IDictionary <string, string>)null))
     .ImplementedBy(_ => TemplatedOperation.ExpandTarget(_, (IDictionary <string, string>)null));
     MulticastObject
     .ImplementationOf <ITemplatedOperation>()
     .ForFunction(_ => _.ExpandTarget((Action <MappingsBuilder>)null))
     .ImplementedBy(_ => TemplatedOperation.ExpandTarget(_, (Action <MappingsBuilder>)null));
     MulticastObject
     .ImplementationOf <IResource>()
     .ForProperty(_ => _.DisplayName)
     .ImplementedBy(_ => ResourceExtensions.GetDisplayName(_));
     MulticastObject
     .ImplementationOf <IResource>()
     .ForProperty(_ => _.TextDescription)
     .ImplementedBy(_ => ResourceExtensions.GetTextDescription(_));
 }
 protected virtual void ProcessLink(TemplatedLink link)
 {
 }