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.Media.Imaging; 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 BitmapImage _avatar; public BitmapImage 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; public void NotifyPropertyChanged(String propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (null != handler) { handler(this, new PropertyChangedEventArgs(propertyName)); } } } }