private void SendMessage(object sender, KeyEventArgs e) { //SendMessage if (e.KeyCode != Keys.Enter || e.Shift || messageTextBox.Text.Length == 0 || !messageTextBox.Visible) //Visible: 2014.11.07. return; messageTextBox.ReadOnly = true; if (!Networking.SendChatMessage(this, messageTextBox.Text)) MessageBox.Show(Language.Translate("networking_alone")); else //else: 2014.10.31. messageTextBox.Text = ""; //messageTextBox.Focus(); messageTextBox.Select(); //2014.12.13. messageTextBox.ReadOnly = false; }
private async void SendMessage(object sender, KeyEventArgs e) { //SendMessage if (e.KeyCode != Keys.Enter || e.Shift || !messageTextBox.Visible) { return; } e.SuppressKeyPress = true; //2015.05.21. if (messageTextBox.Text.Length == 0) { //2015.05.21. return; } messageTextBox.ReadOnly = true; double time = Program.DateTimeToUnixTime(DateTime.Now); if (ChatPartners.Any(entry => entry.UserID != CurrentUser.UserID) && !await Networking.SendChatMessage(this, messageTextBox.Text, time)) //UserID==CurrentUser.UserID: 2015.05.23. { MessageBox.Show(Language.Translate(Language.StringID.Networking_Alone)); } else //else: 2014.10.31. { recentMsgTextBox.GoEnd(); //2015.06.16. ShowReceivedMessageT(UserInfo.Select(CurrentUser.UserID), messageTextBox.Text, time); messageTextBox.Text = ""; } messageTextBox.Select(); //2014.12.13. messageTextBox.ReadOnly = false; }