From 49eb44f852ab21e72c17bbc436ffa79525a1aba3 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 11 Feb 2012 22:22:50 +0400
Subject: v 0.999 :)
---
Juick/ViewModels/MessageViewModel.cs | 159 +++++++++++++++++++++++++++++++++++
1 file changed, 159 insertions(+)
create mode 100644 Juick/ViewModels/MessageViewModel.cs
(limited to 'Juick/ViewModels/MessageViewModel.cs')
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;
+ ///
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ ///
+ ///
+ public int MID
+ {
+ get
+ {
+ return _mid;
+ }
+ set
+ {
+ if (value != _mid)
+ {
+ _mid = value;
+ NotifyPropertyChanged("MID");
+ }
+ }
+ }
+
+ private int _rid;
+ ///
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ ///
+ ///
+ public int RID
+ {
+ get
+ {
+ return _rid;
+ }
+ set
+ {
+ if (value != _rid)
+ {
+ _rid = value;
+ NotifyPropertyChanged("RID");
+ }
+ }
+ }
+ private string _username;
+ ///
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ ///
+ ///
+ 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;
+ ///
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ ///
+ ///
+ public string MessageText
+ {
+ get
+ {
+ return _messageText;
+ }
+ set
+ {
+ if (value != _messageText)
+ {
+ _messageText = value;
+ NotifyPropertyChanged("MessageText");
+ }
+ }
+ }
+
+ private string _status;
+ ///
+ /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
+ ///
+ ///
+ 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
--
cgit v1.2.3