summaryrefslogtreecommitdiff
path: root/Juick/ViewModels
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/ViewModels')
-rw-r--r--Juick/ViewModels/PageViewModel.cs2
-rw-r--r--Juick/ViewModels/PostItem.cs3
-rw-r--r--Juick/ViewModels/UserFeedViewModel.cs41
3 files changed, 45 insertions, 1 deletions
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<PostItem>();
LoadMessagesPageCommand = new DelegateCommand<LinkUnlinkEventArgs>(CheckNewData, () => !context.IsDataLoading);
- NavigateNextCommand = new DelegateCommand<SelectionChangedEventArgs>(NavigateToThread, () => true);
+ NavigateNextCommand = new DelegateCommand<SelectionChangedEventArgs>(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<ThreadViewModel>(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; }
+ }
+ }
+}