public PrivateMessageReplyNotifier(PMModel m)
 {
     this.To = m.To;
     this.From = m.SentBy;
     this.Subject = m.Subject;
     this.Message = m.Details;
 }
 public HttpResponseMessage Post(PMModel message)
 {
     var to = UserData.GetUserIdFromDisplayName(message.To);
     var from = UserData.GetUserIdFromDisplayName(message.SentBy);
     //new message
     if (!message.Subject.StartsWith("Re: "))
     {
         Message.SendPmMessage(from, to, message.Subject, message.Details);
     }
         //reply
     else
     {
         Message.SendPmMessage(from, to, message.Subject, message.Details, message.MessageId);
     }
     return Request.CreateResponse(HttpStatusCode.Created);
 }
   /// <summary>
   /// Initializes a new instance of the <see cref="PrivateMessageDetails"/> class.
   /// </summary>
   public PrivateMessageDetails()
   {
       InitializeComponent();
       this._message = (PMModel)PhoneApplicationService.Current.State["privateMessage"];
       //mark as read
       UiDispatcher.Invoke(() =>
       {
           if (this._message != null)
           {
               new Put("PrivateMessages", this._message.MessageId, "", null, "Read");
               this.From.Text = _message.SentBy;
               this.DateSet.Text = string.Format("{0} {1}", _message.DateSent, "days ago.");
               this.Subject.Text = _message.Subject;
               this.Content.Text = _message.Details;
           }
       });
 
       
   }
 public PrivateMessageReply()
 {
     InitializeComponent();
     //for reply
     if (!PhoneApplicationService.Current.State.ContainsKey("newPm"))
     {
         this._message = (PMModel)PhoneApplicationService.Current.State["privateMessage"];
         if (!this._message.Subject.Contains("Re:"))
         {
             this._message.Subject = string.Format("Re: {0}", this._message.Subject);
         }
         //quote message
         this._message.Details = string.Format("'{0}'", this._message.Details);
         this.Subject.IsEnabled = false;
         this.To.IsEnabled = false;
     }
     //new message
     else
     {
         this._message = new PMModel { SentBy = WindowsPhoneContext.Current.Profile.UserName};
         PhoneApplicationService.Current.State.Remove("newPm");
     }
     this.DataContext = new PrivateMessageReplyNotifier(this._message);
 }