Ejemplo n.º 1
0
 private void WriteLinkAttachment(string name, string link, string caption, string description, HtmlTextWriter output) {
     output.Write("<div style=\"margin-left:10px\">");
     WriteLink(name, link, output);
     output.Write("<br />");
     //html += FormatLink(name, link, output) + "<br />";
     output.EnterStyle(AttachmentStyle);
     output.Write(caption);
     output.Write("<br />");
     output.Write(description);
     output.ExitStyle(AttachmentStyle);
     output.Write("</div>");
     //html += "<span class=\"LikeBox_Attachment\">" + caption + "</span><br />";
     //html += "<span class=\"LikeBox_Attachment\">" + description + "</span><br />";
     //html += "</div>";
 }
Ejemplo n.º 2
0
        private void OutputFeed(HtmlTextWriter output) {
            string Posts = Helpers.WebResponseHelper.GetWebResponse(String.Format("https://graph.facebook.com/{0}/posts?{1}", FacebookID, _Limit != null ? "limit=" + _Limit.ToString() : ""));

            JsonObject PostJO = new JsonObject(Posts);

            JsonArray PostJA = (JsonArray)PostJO["data"];

            output.Write(String.Format("<div style=\"width:100%; height:{0}px; overflow:scroll; overflow-x:hidden;\">", _FeedHeight));
            output.Write(String.Format("<div style=\"padding:{0}px\">", _Padding));
            for (int i = 0; i < PostJA.JsonObjects.Count; i++) {
                JsonObject Post = PostJA.JsonObjects[i];
                JsonObject From = (JsonObject)Post["from"];
                if ((string)From["id"] == FacebookPage.id) {
                    if (ShowTitleInFeed) {
                        WriteLink(FacebookPage.name, FacebookPage.link, output);
                        output.Write(" ");
                    }
                    output.Write((string)Post["message"] + "<br />");
                    if ((string)Post["picture"] != null) output.Write(String.Format("<img src=\"{0}\" style=\"margin-left:10px\"/><br />", Post["picture"]));
                    if ((string)Post["type"] == "link") WriteLinkAttachment((string)Post["name"], (string)Post["link"], (string)Post["caption"], (string)Post["description"],output);
                    DateTime date = Helpers.Generic.RFC3339ToDateTime((string)Post["created_time"]);
                    output.EnterStyle(DateStyle);
                    output.Write(date.Add(UTCOffset).ToString(DateFormatString));
                    output.ExitStyle(DateStyle);
                }
                if (i != PostJA.JsonObjects.Count - 1) output.Write("<hr />");
            }
            output.Write("</div>");
            output.Write("</div>");

            //output.Write(JsonHelper.JsonToHtml(PostJO));
        }
Ejemplo n.º 3
0
 private void WriteLink(string name, string href, HtmlTextWriter output) {
     output.AddAttribute("href", href);
     output.EnterStyle(LinkStyle,HtmlTextWriterTag.A);
     output.Write(name);
     output.ExitStyle(LinkStyle,HtmlTextWriterTag.A);
     
 }
Ejemplo n.º 4
0
        private void OutputHeader(HtmlTextWriter output) {
            string ImgUrl = Helpers.WebResponseHelper.GetWebResponseRedirectURL(String.Format("https://graph.facebook.com/{0}/picture", FacebookID));

            HtmlTextWriter H = new HtmlTextWriter(output.InnerWriter);
            H.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "#DFF1FF");
            HeaderStyle.AddAttributesToRender(H);
            H.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");


            H.RenderBeginTag(HtmlTextWriterTag.Div);

            H.Write(String.Format("<div style=\"padding:{0}px\">",_Padding)+
                "<table><tr>");
            if (ShowLogo) H.Write(String.Format("<td><img src=\"{0}\" alt=\"\"/></td>", ImgUrl));
            H.Write("<td style=\"width:100%\">");

            Style DefaultHeaderCaptionStyle = new Style();
            DefaultHeaderCaptionStyle.Font.Size = FontUnit.Parse("150%");
            HeaderCaptionStyle.MergeWith(LinkStyle);
            HeaderCaptionStyle.MergeWith(DefaultHeaderCaptionStyle);

            H.AddAttribute("href", FacebookPage.link);
            H.EnterStyle(HeaderCaptionStyle, HtmlTextWriterTag.A);
            //WriteLink((string)MetadataJO["name"], (string)MetadataJO["link"], H);
            H.Write(FacebookPage.name);
            H.ExitStyle(HeaderCaptionStyle, HtmlTextWriterTag.A);

            H.Write(" on Facebook");
            H.Write("</td></tr></table></div>");

            H.RenderEndTag();
        }