private void OnSendMsgButtonClick(object sender, EventArgs e) { udpClient.SendMsg(MessageTextBox.Text); MessageDisplayTextBox.AppendText(MessageTextBox.Text + "\r\n"); MessageDisplayTextBox.Refresh(); MessageTextBox.Clear(); }
private void SendButton_Click(object sender, EventArgs e) { if (UserList.SelectedIndex >= 0 && MessageTextBox.Text != "") { Thread waiting_thread = new Thread(new ThreadStart(new Action(() => { WaitingForm form = new WaitingForm("Отправка..."); form.ShowDialog(); }))); waiting_thread.Start(); ActionResult result = client.SendMessage(user_name, UserList.SelectedItem.ToString(), MessageTextBox.Text); try { waiting_thread.Abort(); } catch (Exception ex) { } if (!result.Result) { MessageBox.Show(result.Data, ErrorMessages.ERR_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { AddMessage(user_name, UserList.SelectedItem.ToString(), MessageTextBox.Text); MessageTextBox.Clear(); } } else { MessageBox.Show("Вы не выбрали получателя либо не ввели текст сообщения!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void start() { try { client = new MqttClient(host, port, false, null); client.Connect(Guid.NewGuid().ToString(), username, password); client.MqttMsgPublishReceived += new MqttClient.MqttMsgPublishEventHandler(client_MqttMsgPublishReceived); } catch { label4.Text = "Can't connect to server"; } if (client != null && client.IsConnected) { label4.Text = ""; MessageTextBox.Clear(); } button2.Enabled = false; timer3.Enabled = true; c_id = System.IO.File.ReadAllText("C_ID.text"); if (c_id == "") { c_id = "rds" + generateID(); System.IO.StreamWriter file = new System.IO.StreamWriter("C_ID.text"); file.Write(c_id); file.Close(); } Subscribe(c_id); Run_Config(); timer1.Enabled = true; // Read Config }
private void SendMessage(object s, RoutedEventArgs ev) { Client.SendMessage(MessageTextBox.Text); Dispatcher.Invoke(() => { AppendMessage(MessageTextBox.Text, DateTime.Now); MessageTextBox.Clear(); }); }
private async void SendButton_Click(object sender, EventArgs e) { await Task.Run(() => { byte[] buffer = Encoding.UTF8.GetBytes($"{UserName}: {MessageTextBox.Text}"); ClientSocket.Send(buffer); MessageTextBox.Clear(); }); }
private void MessageTextBox_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && (e.KeyboardDevice.Modifiers & ModifierKeys.Shift) != ModifierKeys.Shift) { _viewModel.AddMessage(MessageTextBox.Text); MessageTextBox.Clear(); e.Handled = true; } }
private void OnKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { udpClient.SendMsg(MessageTextBox.Text); MessageDisplayTextBox.AppendText(MessageTextBox.Text + "\r\n"); MessageDisplayTextBox.Refresh(); MessageTextBox.Clear(); } }
private void NewBtn_Click(object sender, RoutedEventArgs e) { //to clear all textbox and be ready to save InvoiceTxtbox.Clear(); CustNameTxbox.Clear(); CustEmailTxtbox.Clear(); CustAddressTxbox.Clear(); MessageTextBox.Clear(); isNewRecord = true; }
private void SendText() { JObject request = new JObject(); request.Add("action", "send_message"); request.Add("message", MessageTextBox.Text); SendRequest(client, request); MessageTextBox.Clear(); MessageTextBox.Focus(); }
private void ChatButton_Click(object sender, EventArgs e) { ChatListBox.Items.Add("..............."); ChatListBox.Items.Add("Ви:"); ChatListBox.Items.Add(MessageTextBox.Text); MessageTextBox.Clear(); ChatListBox.Items.Add("..............."); ChatListBox.Items.Add("Оператор:"); ChatListBox.Items.Add("Залиште Ваш номер, i оператор передзвонить Вам"); }
private void SendMessage(object sender, RoutedEventArgs e) { var trimmedText = MessageTextBox.Text.Trim(' '); if (trimmedText == "") { return; } SendCommand(RatCommand.SendMessage, Common.MessageEncoding.GetBytes(trimmedText)); MessageTextBox.Clear(); }
private void DisconnectUpdateUI() { Invoke((MethodInvoker)(() => { Connect.Enabled = true; MessagePanel.Enabled = false; Disconnect.Enabled = false; ChatHistory.Clear(); Connect.Focus(); MessageTextBox.Clear(); })); }
private void DisplayLog() { MessageTextBox.Clear(); Room.Log.LockReading(delegate() { foreach (ChatMessage message in Room.Log) { Chat_Update(message); } }); }
private void SendBtn_Click(object sender, EventArgs e) { try { SendMessage(MessageTextBox.Text); ChatListBox.Items.Add(LoginForm.UserName + ": " + MessageTextBox.Text); MessageTextBox.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void SendButton_Click(object sender, EventArgs e) { if (ClientListBox.SelectedIndex == -1) { MessageBox.Show("Please choose a client to talk to.", "Invalid request!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (!string.IsNullOrWhiteSpace(MessageTextBox.Text)) { SendMessage(); } MessageTextBox.Clear(); }
void ConnectButtonClick(object sender, EventArgs e) { int port; //if(HostTextBoxold.Text.Length == 0) if (HostComboBox.Text.Length == 0) { label4.Text = "Invalid host"; } else if (!Int32.TryParse(PortTextBox.Text, out port)) { label4.Text = "Invalid port"; } else { try { client = new MqttClient(HostComboBox.Text); //client = new MqttClient(HostTextBoxold.Text); client.ProtocolVersion = MqttProtocolVersion.Version_3_1; //client.Connect(Guid.NewGuid().ToString()); //client.Connect(Guid.NewGuid().ToString().Substring(0, 22),textBox1.Text,textBox2.Text,true,120); client.Connect(Guid.NewGuid().ToString().Substring(0, 22), UserComboBox.Text, textBox2.Text, true, 120); client.MqttMsgPublishReceived += new MqttClient.MqttMsgPublishEventHandler(client_MqttMsgPublishReceived); } catch { label4.Text = "Can't connect to server"; } if (client != null && client.IsConnected) { this.AcceptButton = this.PublishButton; label4.Text = ""; MessageTextBox.Clear(); SubscribeButton.Enabled = true; PublishButton.Enabled = true; UnsubscribeButton.Enabled = true; DisconnectButton.Enabled = true; ConnectButton.Enabled = false; //HostTextBoxold.Enabled = false; UserComboBox.Enabled = false; PortTextBox.Enabled = false; } else { label4.Text = "Connected to server is false"; } } }
/// <summary> /// Send a new message /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void SendButton_Click(object sender, RoutedEventArgs e) { ContactPerson contact = (ContactPerson)ContactListListView.SelectedItem; if (contact == null) { return; } EncryptedPacket packetForReceiver = null, packetForSender = null; string text = MessageTextBox.Text; await Task.Run(() => { try { packetForReceiver = HybridEncryption.Encrypt(DataType.Message, Encoding.UTF8.GetBytes(text), AsymmetricEncryption.PublicKeyFromXml(contact.PublicKey)); packetForSender = HybridEncryption.Encrypt(DataType.Message, Encoding.UTF8.GetBytes(text), AsymmetricEncryption.PublicKey); } catch (CryptoException exception) { ErrorText = exception.Message; } }); // try to send message and clear input if (packetForReceiver != null && packetForSender != null) { try { // send to server await Client.SendNewMessage(packetForReceiver, contact.Id, true); await Client.SendNewMessage(packetForSender, contact.Id, false); // add to chat contact.Messages.Add(new Message { SenderName = Client.UserName, SendTime = DateTime.Now, MessageFromSender = MessageTextBox.Text, DataType = DataType.Message }); MessageTextBox.Clear(); } catch (ClientException exception) { // show message to user ErrorText = exception.Message; } } }
private void SendButton_Click(object sender, RoutedEventArgs e) { var chatMessage = new ChatMessage() { From = "Admin", SentDateTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"), Message = MessageTextBox.Text, IsAdminMessage = true }; _chatEngine.SendToClient(chatMessage.Message, ChatClient.ClientId); MessageTextBox.Clear(); MessageTextBox.Focus(); }
private void MessageTextBox_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && e.Key == Key.LeftAlt) { MessageTextBox.Text += Environment.NewLine; } if (e.Key == Key.Enter) { byte[] buffer = Encoding.Unicode.GetBytes($"{MainWindow.CurrentBruger.Brugernavn}: {MessageTextBox.Text}"); ClientSocket.SendMessage(buffer); MessageTextBox.Clear(); } }
private void sendMessage(object sender, RoutedEventArgs e) { ChatHistoryTextBox.Dispatcher.Invoke(() => ChatHistoryTextBox.AppendText("Me: " + MessageTextBox.Text + "\n")); //NetworkStream netStream = client.GetStream(); // NetworkStream is a binary stream // BinaryWriter netWriter = new BinaryWriter(netStream); //System.Windows.MessageBox.Show(MessageTextBox.Text); // netWriter.Write("Chat"); // netWriter.Write(MessageTextBox.Text); // netWriter.Flush(); MessageTextBox.Clear(); }
private void NewCdButton_Click(object sender, RoutedEventArgs e) { string artist = AlbumTextBox.Text.Trim(); string album = AlbumTextBox.Text.Trim(); MessageTextBox.Clear(); if (CheckAlbumDataIsEmpty(artist, album)) { return; } _albumData.Add(new AlbumData(artist, album)); }
private void SendButton_Click(object sender, EventArgs e) { try { if (host.sendMesage(MessageTextBox.Text, IPAddress.Parse(DestinationSelector.Text))) { MessageTextBox.Clear(); } } catch (System.FormatException ex) { host.messageQueue.Enqueue(Logger.Log(ex.Message, LogType.ERROR)); } }
private async Task SendMessage() { try { //Calls method in hub - with the three arguments: email, groupid and message await connection.InvokeAsync("SendMessage", _emailAddress, _groupId, MessageTextBox.Text); MessageTextBox.Clear(); MessageTextBox.Focus(); } catch (Exception exception) { MessageList.AppendText(exception.Message); } }
private void SendMessageBtn_Click(object sender, RoutedEventArgs e) { try { string message = String.Format(MessageTextBox.Text); byte[] data = Encoding.Unicode.GetBytes(message); stream.Write(data, 0, data.Length); MessageTextBox.Clear(); MainChatTextBox.AppendText(Environment.NewLine + "Вы: " + message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Send() { byte[] buffer; var messageInfo = new MessageInfo(UserNameTextBox.Text, MessageTextBox.Text, ColorComboBox.SelectedValue.ToString()); using (var stream = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(stream, messageInfo); buffer = stream.ToArray(); } _sender.Send(buffer, buffer.Length, _remoteEP); MessageTextBox.Clear(); }
private void SendButton_Click(object sender, RoutedEventArgs e) { var text = MessageTextBox.Text; if (text.Length > 0) { var newMessage = new UserMessage { Message = text }; Messages.Add(newMessage); Client.SendMessage(newMessage); MessageTextBox.Clear(); } }
private void MessageTextBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { var text = MessageTextBox.Text.Trim(); if (!string.IsNullOrEmpty(text)) { var session = GetSession(); WriteChat(session.FirstName, text); var dialog = _assistant.GetResponseForText(session, text); ProcessDialog(dialog); MessageTextBox.Clear(); } e.Handled = true; } }
private void SendButton_Click(object sender, EventArgs e) { try { System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); byte[] msg = new byte[1500]; msg = enc.GetBytes(MessageTextBox.Text); sck.Send(msg); ListMessage.Items.Add("Me: " + MessageTextBox.Text); MessageTextBox.Clear(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void DisplayLog() { MessageTextBox.Clear(); IMStatus status = null; if (!IM.IMMap.SafeTryGetValue(UserID, out status)) { return; } status.MessageLog.LockReading(delegate() { foreach (InstantMessage message in status.MessageLog) { IM_MessageUpdate(UserID, message); } }); }
private void PostButton_Click(object sender, EventArgs e) { string name = UserNameTextBox.Text; string qq = QQTextBox.Text; string email = EmailTextBox.Text; string title = TitleTextBox.Text; string msg = MessageTextBox.Text; string log = ""; if (!string.IsNullOrEmpty(LogPathTextBox.Text)) { if (File.Exists(LogPathTextBox.Text)) { log = ReadLogFile(LogPathTextBox.Text); } else { ShowErrorMessage("请输入正确的日志文件路径!"); return; } } if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(title) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(msg)) { ShowWarningMessage("请填写以上必填项后再提交!"); return; } ServiceReference.WebServiceSoapClient service = new ServiceReference.WebServiceSoapClient(); bool flag = service.PostFeedback(name, qq, email, title, msg, log); if (flag) { ShowInfoMessage("提交成功,感谢反馈!"); } else { ShowErrorMessage("提交失败!"); } TitleTextBox.Clear(); MessageTextBox.Clear(); }