private void Send_Click(object sender, EventArgs e) { string message = ChatMessage.Text.ToString(); if (username.Text == string.Empty || username.Text == "userName") { richTextBox1.Text = "Please Select a User / Find a user to chat with"; } else { if (message.Length > 300) { Counter.Text = "Please shorten message"; } else if (message == string.Empty) { Counter.Text = "Please enter a message to be sent"; } else { SendMessage(getIdoffullName(username.Text), message); richTextBox1.SelectionAlignment = HorizontalAlignment.Right; richTextBox1.AppendText(getNameOfId(Logininfo.userid) + ":" + Environment.NewLine + message); richTextBox1.AppendText(Environment.NewLine); richTextBox1.ScrollToCaret(); ChatMessage.Clear(); } } }
private void SendBtn_Click(object sender, RoutedEventArgs e) { client.SendData(ConvertStringToBytes(ChatMessage.Text)); //Sends the message to the host ChatMessage.Clear(); //Clears the chatmessage textbox text }