void socketClient_ReceivedMsg(string msg) { Application.Current.Dispatcher.BeginInvoke(new Action(delegate { ChatUser us = _contact_latest[3] as ChatUser; //ChatUser us = this._friendUser; SocketMsg smsg = new SocketMsg(); smsg.setAllParametersJsonStr(msg); Hashtable param = smsg.getAllParameters(); ChatMsgData msg1 = new ChatMsgData(); msg1.From = us.UserName; msg1.Msg = param["content"].ToString(); msg1.Readed = false; msg1.Time = DateTime.Now; msg1.To = _me.UserName; msg1.Type = 1; us.UnReadCount = us.UnReadCount + 1; us.ReceivedMsg(msg1); })); }