summaryrefslogtreecommitdiff
path: root/Juick/ViewModels
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2012-03-10 20:59:39 +0400
committerGravatar Vitaly Takmazov2012-03-10 20:59:39 +0400
commit4a664984f58b00493a61cb19fafc0ca01d35b930 (patch)
tree5af7c0ba8165c8bfd63683a6e40702449f5eded6 /Juick/ViewModels
parent1daf00012658f8cf770eac1ad35bcb23159f29e8 (diff)
remove AvatarClient
Diffstat (limited to 'Juick/ViewModels')
-rw-r--r--Juick/ViewModels/MainViewModel.cs37
-rw-r--r--Juick/ViewModels/ThreadViewModel.cs20
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");