public void SetPageCalculation(LinkRelationship relationship, Func <PaginationInfo, Uri> function) => _pageDataCalculators[relationship.GetLinkHeaderValue()] = info => new PageData { PageLink = function(info), LinkRelationshipType = relationship.GetLinkHeaderValue() };
public Link(Uri href, string title, LinkRelationship relationship, string type) { _href = href; _title = title; _relationship = relationship; _type = type; }
/// <summary> /// Adds a new LinkRelationship to the Model. /// </summary> /// <param name="link">The Link object associated with the new LinkRelationship.</param> /// <param name="dataSource">The DataSource to which the LinkRelationship will be added.</param> private void AddLinkRelationshipToModel(Link link, DataSource dataSource) { LinkRelationship linkRelationship = Model.AddLinkRelationship(link, dataSource); // Add View Model. if (LinkRelationshipsVM.LinkRelationships == null) { throw new InvalidOperationException("LinkRelationships was null!"); } // MainViewModel knows about LinkRelationShipVM AND has access to the new linkRelationship. // That's why it makes sense to do this here. LinkRelationshipsVM.LinkRelationships.Add(new LinkRelationshipViewModel(linkRelationship)); }
public static string GetRelationshipAttributeValue(LinkRelationship rel) { switch (rel) { case LinkRelationship.Alternate: return LinkAlternateAttributeValue; case LinkRelationship.Enclosure: return LinkEnclosureAttributeValue; case LinkRelationship.Related: return LinkRelatedAttributeValue; case LinkRelationship.Self: return LinkSelfAttributeValue; case LinkRelationship.Via: return LinkViaAttributeValue; case LinkRelationship.None: default: return LinkNoneAttributeValue; } }
public RemoveLinkRelationship(LinkRelationship linkRelationship, DataSource dataSource) { LinkRelationship = linkRelationship; DataSource = dataSource; }
public Link(Uri href, string title, LinkRelationship relationship) : this(href, title, relationship, null) { }
public Link(Uri href, LinkRelationship relationship) : this(href, null, relationship, null) { }
public LinkRelationshipViewModel(LinkRelationship linkRelationship) { LinkRelationship = linkRelationship; }
/// <summary> /// Adds a new LinkRelationship to the Model. /// </summary> /// <param name="link">The Link object associated with the new LinkRelationship.</param> /// <param name="dataSource">The DataSource to which the LinkRelationship will be added.</param> private static void RemoveLinkRelationshipFromModel(LinkRelationship link, DataSource dataSource) { Model.RemoveLinkRelationship(link, dataSource); }
public IEnumerable<Link> GetLinks(LinkRelationship relationship) { foreach (Link link in this.Links) if (link.Relationship == relationship) yield return link; }