diff options
Diffstat (limited to 'Juick/ViewModels')
-rw-r--r-- | Juick/ViewModels/MainViewModel.cs | 37 | ||||
-rw-r--r-- | Juick/ViewModels/ThreadViewModel.cs | 20 |
2 files changed, 16 insertions, 41 deletions
diff --git a/Juick/ViewModels/MainViewModel.cs b/Juick/ViewModels/MainViewModel.cs index ed244d7..3ee4a16 100644 --- a/Juick/ViewModels/MainViewModel.cs +++ b/Juick/ViewModels/MainViewModel.cs @@ -66,20 +66,13 @@ namespace Juick.ViewModels post.Replies)
};
MyFeed.Add(item);
- var imageRequest =
- new RestRequest(
- string.Format("/as/{0}.png",
- post.User.Uid));
- App.AvatarClient.ExecuteAsync(
- imageRequest, restResponse =>
+ var imageUri = new Uri(string.Format("http://i.juick.com/as/{0}.png", post.User.Uid), UriKind.Absolute);
+ item.UserAvatar = new BitmapImage
{
- item.UserAvatar = new BitmapImage
- ();
- item.UserAvatar.SetSource(new MemoryStream(restResponse.RawBytes));
- item.
- NotifyPropertyChanged
- ("UserAvatar");
- });
+ UriSource = imageUri
+ };
+ item.NotifyPropertyChanged("UserAvatar");
+
});
NotifyPropertyChanged("MyFeed");
@@ -102,20 +95,10 @@ namespace Juick.ViewModels post.Replies)
};
Last.Add(item);
- var imageRequest =
- new RestRequest(
- string.Format("/as/{0}.png",
- post.User.Uid));
- App.AvatarClient.ExecuteAsync(
- imageRequest, restResponse =>
- {
- item.UserAvatar = new BitmapImage
- ();
- item.UserAvatar.SetSource(new MemoryStream(restResponse.RawBytes));
- item.
- NotifyPropertyChanged
- ("UserAvatar");
- });
+ var imageUri = new Uri(string.Format("http://i.juick.com/as/{0}.png", post.User.Uid), UriKind.Absolute);
+ item.UserAvatar = new BitmapImage {UriSource = imageUri};
+ item.NotifyPropertyChanged("UserAvatar");
+
if (post.Photo != null)
{
item.Attachment = new BitmapImage {UriSource = new Uri(post.Photo.Small, UriKind.Absolute)};
diff --git a/Juick/ViewModels/ThreadViewModel.cs b/Juick/ViewModels/ThreadViewModel.cs index 80d8b3e..a929700 100644 --- a/Juick/ViewModels/ThreadViewModel.cs +++ b/Juick/ViewModels/ThreadViewModel.cs @@ -48,20 +48,12 @@ namespace Juick.ViewModels {
var item = new MessageViewModel(post);
Items.Add(item);
- var imageRequest =
- new RestRequest(
- string.Format("/as/{0}.png",
- post.User.Uid));
- App.AvatarClient.ExecuteAsync(
- imageRequest, restResponse =>
- {
- item.UserAvatar = new BitmapImage
- ();
- item.UserAvatar.SetSource(new MemoryStream(restResponse.RawBytes));
- item.
- NotifyPropertyChanged
- ("UserAvatar");
- });
+ var imageUri = new Uri(string.Format("http://i.juick.com/as/{0}.png", post.User.Uid), UriKind.Absolute);
+ item.UserAvatar = new BitmapImage
+ {
+ UriSource = imageUri
+ };
+ item.NotifyPropertyChanged("UserAvatar");
});
IsDataLoaded = true;
NotifyPropertyChanged("Items");
|