summaryrefslogtreecommitdiff
path: root/Juick/ViewModels/MessageViewModel.cs
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2012-02-11 22:22:50 +0400
committerGravatar Vitaly Takmazov2012-02-11 22:22:50 +0400
commit49eb44f852ab21e72c17bbc436ffa79525a1aba3 (patch)
tree249cd1d69dc8078104dc2bc35cfcbbce98cd85f4 /Juick/ViewModels/MessageViewModel.cs
v 0.999 :)
Diffstat (limited to 'Juick/ViewModels/MessageViewModel.cs')
-rw-r--r--Juick/ViewModels/MessageViewModel.cs159
1 files changed, 159 insertions, 0 deletions
diff --git a/Juick/ViewModels/MessageViewModel.cs b/Juick/ViewModels/MessageViewModel.cs
new file mode 100644
index 0000000..32da0aa
--- /dev/null
+++ b/Juick/ViewModels/MessageViewModel.cs
@@ -0,0 +1,159 @@
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+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.Api;
+
+namespace Juick
+{
+ public class MessageViewModel : INotifyPropertyChanged
+ {
+ public MessageViewModel()
+ {
+
+ }
+
+ public MessageViewModel(Message message)
+ {
+ MID = message.mid;
+ RID = message.rid;
+ Username = message.user.uname;
+ MessageText = HttpUtility.HtmlDecode(message.body);
+ }
+ private int _mid;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public int MID
+ {
+ get
+ {
+ return _mid;
+ }
+ set
+ {
+ if (value != _mid)
+ {
+ _mid = value;
+ NotifyPropertyChanged("MID");
+ }
+ }
+ }
+
+ private int _rid;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public int RID
+ {
+ get
+ {
+ return _rid;
+ }
+ set
+ {
+ if (value != _rid)
+ {
+ _rid = value;
+ NotifyPropertyChanged("RID");
+ }
+ }
+ }
+ private string _username;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public string Username
+ {
+ get
+ {
+ return _username;
+ }
+ set
+ {
+ if (value != _username)
+ {
+ _username = value;
+ NotifyPropertyChanged("Username");
+ }
+ }
+ }
+
+ private Image _avatar;
+ public Image UserAvatar
+ {
+ get { return _avatar; }
+ set
+ {
+ if (value != _avatar)
+ {
+ _avatar = value;
+ NotifyPropertyChanged("Useravatar");
+ }
+ }
+ }
+
+ private string _messageText;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public string MessageText
+ {
+ get
+ {
+ return _messageText;
+ }
+ set
+ {
+ if (value != _messageText)
+ {
+ _messageText = value;
+ NotifyPropertyChanged("MessageText");
+ }
+ }
+ }
+
+ private string _status;
+ /// <summary>
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ /// </summary>
+ /// <returns></returns>
+ public string Status
+ {
+ get
+ {
+ return _status;
+ }
+ set
+ {
+ if (value != _status)
+ {
+ _status = value;
+ NotifyPropertyChanged("Status");
+ }
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ private void NotifyPropertyChanged(String propertyName)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (null != handler)
+ {
+ handler(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+} \ No newline at end of file