Пример #1
0
        private static Message CreateStatusMessage(JsonObject jsonData)
        {
            var msg = new FacebookMessage
            {
                Text     = HttpUtility.HtmlEncode((string)jsonData["message"]),
                PostedOn = Convert.ToDateTime(jsonData["updated_time"].ToString()),
                Source   = SocialNetworks.Facebook
            };

            var jsonUser = (JsonObject)(jsonData["from"]);

            msg.UserName     = jsonUser["name"].ToString();
            msg.UserImageUrl = String.Format("http://graph.facebook.com/{0}/picture?type=small", jsonUser["id"]);

            return(msg);
        }
Пример #2
0
        private static Message CreateVideoMessage(JsonObject jsonData)
        {
            var msg = new FacebookMessage();

            var text = "<br />";

            if (jsonData.ContainsKey("message"))
            {
                text += HttpUtility.HtmlEncode((string)jsonData["message"]);
                text += "<br /><br />";
            }
            text += String.Format("<a href='{0}' target='_blank'><img src='{1}' /></a><br /><br />", jsonData["link"], jsonData["picture"]);

            msg.Text     = text;
            msg.PostedOn = Convert.ToDateTime(jsonData["updated_time"].ToString());
            msg.Source   = SocialNetworks.Facebook;

            var jsonUser = (JsonObject)(jsonData["from"]);

            msg.UserName     = jsonUser["name"].ToString();
            msg.UserImageUrl = String.Format("http://graph.facebook.com/{0}/picture?type=small", jsonUser["id"]);

            return(msg);
        }