public void ShowMessage(Message m)
 {
     chatArea.Dispatcher.Invoke(
         DispatcherPriority.Normal,
             new Action(
                 delegate()
                 {
                     chatArea.Text += ("[" + m.Sent + "] " + m.Username + ": " + m.Text);
                     chatArea.Text += Environment.NewLine;
                     chatArea.ScrollToEnd();
                 }
         ));
 }
 //public methods
 public async void SendMessage(Message m)
 {
     try
     {
         HttpResponseMessage response = await _client.PostAsync("api/chat", m.serializedMessage);
         if (response.StatusCode != System.Net.HttpStatusCode.OK)
             ShowError("Partner responded, but awkwardly! Better hide!");
         ShowMessage(m);
     }
     catch (Exception e)
     {
         stopChatServer();
         ShowError("Partner unreachable. Closing your server!");
     }
 }
 public MessageEventArgs(Message m)
 {
     this.Message = m;
 }
 public void MessageArrived(Message m)
 {
     ThrowMessageArrivedEvent(this, new MessageEventArgs(m));
 }
 private void ShowMessage(Message m)
 {
     _srm(m);
 }
 private void sendMessage(Message m)
 {
     _cp.SendMessage(m);
     inputText.Clear();
 }