diff options
author | Vitaly Takmazov | 2013-03-29 12:47:25 +0400 |
---|---|---|
committer | Vitaly Takmazov | 2013-03-29 12:47:25 +0400 |
commit | e20d55789c6ab0c2c6324eb6806c12cc96723eca (patch) | |
tree | 0b947cf4394b086fa27ac4c210ffc9c673e6f4c5 /Juick/ViewModels | |
parent | a84c894c89f23e3eb6416ff8943d4d8a2fe84a49 (diff) | |
parent | 6df49ee7c25d739ec6445a13e1aa828a4da41730 (diff) |
Merge branch 'master' of https://bitbucket.org/vitalyster/juick-windowsphone
Diffstat (limited to 'Juick/ViewModels')
-rw-r--r-- | Juick/ViewModels/MessageListViewModelBase.cs | 16 | ||||
-rw-r--r-- | Juick/ViewModels/MessageViewModel.cs | 16 | ||||
-rw-r--r-- | Juick/ViewModels/ThreadViewModel.cs | 9 |
3 files changed, 26 insertions, 15 deletions
diff --git a/Juick/ViewModels/MessageListViewModelBase.cs b/Juick/ViewModels/MessageListViewModelBase.cs index b9d7070..3eb1842 100644 --- a/Juick/ViewModels/MessageListViewModelBase.cs +++ b/Juick/ViewModels/MessageListViewModelBase.cs @@ -13,6 +13,7 @@ namespace Juick.ViewModels {
public class MessageListViewModelBase : INotifyPropertyChanged
{
+ static readonly string IsDataLoadingPropertyName = ExpressionHelper.GetPropertyName<MessageListViewModelBase>(x => x.IsDataLoading);
bool isDataLoading;
public MessageListViewModelBase()
@@ -22,6 +23,7 @@ namespace Juick.ViewModels }
public string RestUri { get; set; }
+ public virtual string Caption { get { return "juick"; } }
/// <summary>
/// A collection for MessageViewModel objects.
@@ -36,7 +38,7 @@ namespace Juick.ViewModels set
{
isDataLoading = value;
- NotifyPropertyChanged("IsDataLoading");
+ NotifyPropertyChanged(IsDataLoadingPropertyName);
LoadMessagesPageCommand.NotifyCanExecuteChanged();
}
}
@@ -89,14 +91,16 @@ namespace Juick.ViewModels foreach (var post in response.Data)
{
var status = string.Format("Posted on: {0}, replies: {1}", post.Timestamp, post.Replies);
- var item = new MessageViewModel(post) { Status = status };
- Items.Add(item);
- var imageUri = new Uri(string.Format("http://i.juick.com/as/{0}.png", post.User.Uid), UriKind.Absolute);
- item.UserAvatar = new BitmapImage { UriSource = imageUri };
+ var item = new MessageViewModel(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 BitmapImage { UriSource = new Uri(post.Photo.Small, UriKind.Absolute) };
+ item.Attachment = new Uri(post.Photo.Small, UriKind.Absolute) ;
}
+ Items.Add(item);
}
}
diff --git a/Juick/ViewModels/MessageViewModel.cs b/Juick/ViewModels/MessageViewModel.cs index 6a53669..750864a 100644 --- a/Juick/ViewModels/MessageViewModel.cs +++ b/Juick/ViewModels/MessageViewModel.cs @@ -88,22 +88,22 @@ namespace Juick.ViewModels }
}
- private BitmapImage _avatar;
- public BitmapImage UserAvatar
+ private Uri _avatarUri;
+ public Uri AvatarUri
{
- get { return _avatar; }
+ get { return _avatarUri; }
set
{
- if (value != _avatar)
+ if (value != _avatarUri)
{
- _avatar = value;
- NotifyPropertyChanged("UserAvatar");
+ _avatarUri = value;
+ NotifyPropertyChanged("AvatarUri");
}
}
}
- private BitmapImage _attach;
- public BitmapImage Attachment
+ private Uri _attach;
+ public Uri Attachment
{
get { return _attach; }
set
diff --git a/Juick/ViewModels/ThreadViewModel.cs b/Juick/ViewModels/ThreadViewModel.cs index 4a80f31..ec1f92d 100644 --- a/Juick/ViewModels/ThreadViewModel.cs +++ b/Juick/ViewModels/ThreadViewModel.cs @@ -1,9 +1,11 @@ -using System;
+using Juick.Classes;
namespace Juick.ViewModels
{
public class ThreadViewModel : MessageListViewModelBase
{
+ static readonly string CaptionPropertyName = ExpressionHelper.GetPropertyName<ThreadViewModel>(x => x.Caption);
+
private int _mid;
public int Mid
{
@@ -12,7 +14,12 @@ namespace Juick.ViewModels {
_mid = value;
RestUri = string.Format("/thread?mid={0}", _mid);
+ NotifyPropertyChanged(CaptionPropertyName);
}
}
+
+ public override string Caption {
+ get { return "#" + _mid; }
+ }
}
}
|