From 1a9bcf2f3ac5f40e8966fb365741d36906fd2e52 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 8 May 2013 16:12:45 +0400 Subject: UserFeed --- Juick/ViewModels/PageViewModel.cs | 2 +- Juick/ViewModels/PostItem.cs | 3 +++ Juick/ViewModels/UserFeedViewModel.cs | 41 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Juick/ViewModels/UserFeedViewModel.cs (limited to 'Juick/ViewModels') diff --git a/Juick/ViewModels/PageViewModel.cs b/Juick/ViewModels/PageViewModel.cs index ce48449..0d57f6a 100644 --- a/Juick/ViewModels/PageViewModel.cs +++ b/Juick/ViewModels/PageViewModel.cs @@ -19,7 +19,7 @@ namespace Juick.ViewModels _context = context; Items = new ObservableCollection(); LoadMessagesPageCommand = new DelegateCommand(CheckNewData, () => !context.IsDataLoading); - NavigateNextCommand = new DelegateCommand(NavigateToThread, () => true); + NavigateNextCommand = new DelegateCommand(NavigateToThread, () => true); } private readonly AppViewModel _context; diff --git a/Juick/ViewModels/PostItem.cs b/Juick/ViewModels/PostItem.cs index 88f6b86..a1b4ec5 100644 --- a/Juick/ViewModels/PostItem.cs +++ b/Juick/ViewModels/PostItem.cs @@ -20,6 +20,7 @@ namespace Juick.ViewModels Status = string.Format("{0}, replies: {1}", Status, message.Replies); MessageText = HttpUtility.HtmlDecode(message.Body); + UserfeedUri = new Uri(string.Format("/UserFeed.xaml?uid={0}", message.User.Uid), UriKind.Relative); if (message.Tags != null) { MessageText = string.Join(", ", message.Tags) + Environment.NewLine + MessageText; @@ -39,6 +40,8 @@ namespace Juick.ViewModels public Uri AvatarUri {get;set;} + public Uri UserfeedUri { get; set; } + public Uri Attachment {get;set;} public string Status {get;set;} diff --git a/Juick/ViewModels/UserFeedViewModel.cs b/Juick/ViewModels/UserFeedViewModel.cs new file mode 100644 index 0000000..597687f --- /dev/null +++ b/Juick/ViewModels/UserFeedViewModel.cs @@ -0,0 +1,41 @@ +using System; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Ink; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; +using Juick.Classes; +using JuickApi; + +namespace Juick.ViewModels +{ + public class UserFeedViewModel : PageViewModel + { + public UserFeedViewModel(AppViewModel context) : base(context) + { + + } + static readonly string CaptionPropertyName = ExpressionHelper.GetPropertyName(x => x.Caption); + + private int _uid; + public int Uid + { + get { return _uid; } + set + { + _uid = value; + RestUri = string.Format("/messages?user_id={0}", _uid); + NotifyPropertyChanged(CaptionPropertyName); + } + } + + public override string Caption + { + get { return Items.Count == 0 ? "": Items[0].Username; } + } + } +} -- cgit v1.2.3