private void InputField_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter && !(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) && !(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.LeftShift))) { if (InputField.Text == "") { return; } if (ClientsComboBox.SelectedIndex == -1) { UpdateChatWindow("[Error] Message has no location, Auto set to [All]", Colors.Red); ClientsComboBox.SelectedIndex = 0; return; } if (ClientsComboBox.SelectedIndex != 0) { client.TcpSendDataToServer(new Packets.PrivateMessagePacket(client.EncryptString(InputField.Text), ClientsComboBox.SelectedItem.ToString())); } else { client.TcpSendDataToServer(new Packets.ChatMessagePacket(client.EncryptString(InputField.Text))); } InputField.Text = ""; } }
private void InputField_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && !(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) && !(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.LeftShift))) { if (InputField.Text == "") { return; } clientManager.TcpSendDataToServer(new Packets.PictionaryChatMessagePacket(clientManager.EncryptString(InputField.Text))); InputField.Text = ""; } }