Ejemplo n.º 1
0
 private void ParseChat(JObject joChat)
 {
     Chat chat = new Chat();
     chat.ChatId = joChat.ParseJsonInt("id");
     chat.UserId = joChat.ParseJsonInt("user_id");
     chat.Content = joChat.ParseJsonString("content");
     chat.CreatedAt = joChat.ParseJsonDateTime("created_at");
     chat.UpdatedAt = joChat.ParseJsonDateTime("updated_at");
     chat.PictureFileName = (joChat.SelectToken("picture") as JObject).ParseJsonString("url");
     ChatCollection.Add(chat);
 }
Ejemplo n.º 2
0
        private void ParseChat(JObject joChat)
        {
            Chat chat = new Chat();
            chat.ChatId = joChat.ParseJsonInt("id");
            chat.UserId = joChat.ParseJsonInt("user_id");
            chat.Content = joChat.ParseJsonString("content");
            chat.CreatedAt = joChat.ParseJsonDateTime("created_at");
            chat.UpdatedAt = joChat.ParseJsonDateTime("updated_at");
            chat.PictureFileName = (joChat.SelectToken("picture") as JObject).ParseJsonString("url");

            if (chat.UserId != CurrentUser.Id)
            {
                chat.UserName = Relationships.Followers.Concat(Relationships.Following).Where(u => u.Id == chat.UserId).First().Name;
                chat.UserGravatarUrl = Relationships.Followers.Concat(Relationships.Following).Where(u => u.Id == chat.UserId).First().GravatarUrl;
            }
            else
            {
                chat.UserName = CurrentUser.Name;
                chat.UserGravatarUrl = CurrentUser.GravatarUrl;
            }
            ChatCollection.Add(chat);
        }