/// <summary> /// <para>Returns HTML markup text of widget.</para> /// </summary> /// <returns>Widget's HTML markup.</returns> public override string ToHtmlString() { if (this.Url().IsEmpty() || this.Image().IsEmpty() || this.Description().IsEmpty()) { return(string.Empty); } byte height = 0; switch (this.Size()) { case PinterestPinItButtonSize.Large: switch (this.Shape()) { case PinterestPinItButtonShape.Circular: height = 32; break; case PinterestPinItButtonShape.Rectangular: height = 28; break; } break; case PinterestPinItButtonSize.Small: switch (this.Shape()) { case PinterestPinItButtonShape.Circular: height = 16; break; case PinterestPinItButtonShape.Rectangular: height = 20; break; } break; } string shape = string.Empty; switch (this.Shape()) { case PinterestPinItButtonShape.Rectangular: shape = "rect"; break; case PinterestPinItButtonShape.Circular: shape = "round"; break; } return(new TagBuilder("a") .Attribute("href", "http://www.pinterest.com/pin/create/button/?url={0}&media={1}&description={2}".FormatSelf(HttpUtility.UrlEncode(this.Url()), HttpUtility.UrlEncode(this.Image()), HttpUtility.UrlEncode(this.Description()))) .Attribute("data-pin-do", "buttonPin") .Attribute("data-pin-lang", this.Shape() == PinterestPinItButtonShape.Rectangular ? this.Language() : null) .Attribute("data-pin-config", this.Shape() == PinterestPinItButtonShape.Rectangular ? this.Counter().ToString().ToLowerInvariant() : null) .Attribute("data-pin-color", this.Shape() == PinterestPinItButtonShape.Rectangular ? this.Color() : null) .Attribute("data-pin-height", height) .Attribute("data-pin-shape", shape) .InnerHtml(@"<img src=""http://assets.pinterest.com/images/pidgets/pinit_fg_{0}_{1}_{2}_{3}.png""/>".FormatSelf(this.Language(), shape, this.Color(), height)) .ToString()); }
/// <summary> /// <para>Returns HTML markup text of widget.</para> /// </summary> /// <returns>Widget's HTML markup.</returns> public override string ToHtmlString() { if (this.Url().IsEmpty() || this.Image().IsEmpty() || this.Description().IsEmpty()) { return string.Empty; } byte height = 0; switch (this.Size()) { case PinterestPinItButtonSize.Large : switch (this.Shape()) { case PinterestPinItButtonShape.Circular : height = 32; break; case PinterestPinItButtonShape.Rectangular : height = 28; break; } break; case PinterestPinItButtonSize.Small : switch (this.Shape()) { case PinterestPinItButtonShape.Circular: height = 16; break; case PinterestPinItButtonShape.Rectangular: height = 20; break; } break; } string shape = string.Empty; switch (this.Shape()) { case PinterestPinItButtonShape.Rectangular : shape = "rect"; break; case PinterestPinItButtonShape.Circular : shape = "round"; break; } return new TagBuilder("a") .Attribute("href", "http://www.pinterest.com/pin/create/button/?url={0}&media={1}&description={2}".FormatSelf(HttpUtility.UrlEncode(this.Url()), HttpUtility.UrlEncode(this.Image()), HttpUtility.UrlEncode(this.Description()))) .Attribute("data-pin-do", "buttonPin") .Attribute("data-pin-lang", this.Shape() == PinterestPinItButtonShape.Rectangular ? this.Language() : null) .Attribute("data-pin-config", this.Shape() == PinterestPinItButtonShape.Rectangular ? this.Counter().ToString().ToLowerInvariant() : null) .Attribute("data-pin-color", this.Shape() == PinterestPinItButtonShape.Rectangular ? this.Color() : null) .Attribute("data-pin-height", height) .Attribute("data-pin-shape", shape) .InnerHtml(@"<img src=""http://assets.pinterest.com/images/pidgets/pinit_fg_{0}_{1}_{2}_{3}.png""/>".FormatSelf(this.Language(), shape, this.Color(), height)) .ToString(); }
/// <summary> /// <para>Shape of the button.</para> /// </summary> /// <param name="shape">Button's shape.</param> /// <returns>Reference to the current widget.</returns> public IPinterestPinItButtonWidget Shape(PinterestPinItButtonShape shape) { this.shape = shape; return(this); }
/// <summary> /// <para>Shape of the button.</para> /// </summary> /// <param name="shape">Button's shape.</param> /// <returns>Reference to the current widget.</returns> public IPinterestPinItButtonWidget Shape(PinterestPinItButtonShape shape) { this.shape = shape; return this; }