From b5acc276a59879b5b5a14a1e9efb38b633e53a68 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 29 Mar 2013 14:01:06 +0400 Subject: PostItem refactoring --- Juick/ViewModels/ViewModelBase.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'Juick/ViewModels/ViewModelBase.cs') diff --git a/Juick/ViewModels/ViewModelBase.cs b/Juick/ViewModels/ViewModelBase.cs index e86ff4a..2427a80 100644 --- a/Juick/ViewModels/ViewModelBase.cs +++ b/Juick/ViewModels/ViewModelBase.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; @@ -88,20 +89,8 @@ namespace Juick.ViewModels } //Items.Clear(); - foreach (var post in response.Data) - { - var status = string.Format("Posted on: {0}, replies: {1}", post.Timestamp, post.Replies); - var item = new PostItem(post) - { - Status = status, - AvatarUri = new Uri(string.Format("http://i.juick.com/as/{0}.png", post.User.Uid), UriKind.Absolute) - }; - if (post.Photo != null) - { - item.Attachment = new Uri(post.Photo.Small, UriKind.Absolute) ; - } - Items.Add(item); - } + response.Data.Select(x => new PostItem(x)).ToList().ForEach(i => Items.Add(i)); + } -- cgit v1.2.3