diff options
author | 2013-03-29 14:01:06 +0400 | |
---|---|---|
committer | 2013-03-29 14:01:06 +0400 | |
commit | b5acc276a59879b5b5a14a1e9efb38b633e53a68 (patch) | |
tree | fa12a862fc668329737fbf5e28b21d86c18d9ffa /Juick/ViewModels/ViewModelBase.cs | |
parent | 3be6eccab55ca90a060cb56882c5675a7ad875ce (diff) |
PostItem refactoring
Diffstat (limited to 'Juick/ViewModels/ViewModelBase.cs')
-rw-r--r-- | Juick/ViewModels/ViewModelBase.cs | 17 |
1 files changed, 3 insertions, 14 deletions
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)); + } |