コード例 #1
0
 public void ClearDocument()
 {
     if (Link != null)
     {
         Link.StopPageBuilding();
         Link.Dispose();
         linkCore = null;
     }
 }
コード例 #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));
        }
コード例 #3
0
 public void CreateDocument()
 {
     if (Link == null)
     {
         Link = CreateLink();
         Link.PrintingSystem.PageSettingsChanged += OnPageSettingsChanged;
     }
     ProcessLink(Link);
     Link.CreateDocument(true);
 }
コード例 #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;
        }
コード例 #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());
        }
コード例 #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"]);
        }
コード例 #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;
            }
        }
コード例 #8
0
 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(_));
 }
コード例 #9
0
 protected virtual void ProcessLink(TemplatedLink link)
 {
 }