private void sendMessage() { if (txtChatMessage.Text.Trim() != string.Empty) { RosterItem currentRosterItem = Roster.Instance.Get(Roster.Instance.SelectedItem.Jid); var msg = new Message() { Text = txtChatMessage.Text, Time = DateTime.Now, MessageType = MessageType.Outgoing, MessageStatus = MessageStatus.Sent }; string msgID = client.SendMessage(currentRosterItem.Jid, txtChatMessage.Text); msg.ID = msgID.Substring(7, msgID.IndexOf(',') - 7); currentRosterItem.Add(msg); txtChatMessage.Clear(); } }