//-------------------------------------------------------------------------------------------------------------------------- /// <summary> /// обработка события по нажитию enter, отправка сообщения /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbMessage_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (client != null && privateMsg != true) { client.SendMessage(tbMessage.Text, id); tbMessage.Text = string.Empty; } else if (privateMsg) { string tempMsg = "[Private:] " + ": " + tbMessage.Text; client.PrivateSendMessage(tempMsg, id, needId); lbChat.Items.Add(tempMsg); //!!!!!!! tbMessage.Text = string.Empty; privateMsg = false; TypeMsg.Content = "[General]"; } } if (e.Key == Key.Escape) // отмена личного сообщения { privateMsg = false; tbMessage.Text = ""; TypeMsg.Content = "[General]"; } }