private void client_btn_Click(object sender, RoutedEventArgs e) { try { cmd.ipep = new IPEndPoint(IPAddress.Parse(ipBox.Text), 9999); cmd.client.Connect(cmd.ipep); } catch { CMD_text.AppendText("Exception"); } }
private void CMDsend_Click(object sender, RoutedEventArgs e) { if (cmd.client.Connected) { command = CMDbar.Text; CMDbar.Clear(); cmd.send_data = Encoding.Unicode.GetBytes(command); cmd.client.Send(cmd.send_data); } else { CMD_text.AppendText("client not connected"); } }
private void ipBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { try { cmd.ipep = new IPEndPoint(IPAddress.Parse(ipBox.Text), 9999); cmd.client.Connect(cmd.ipep); } catch { CMD_text.AppendText("Exception"); } } }
private void CMDbar_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { if (cmd.client.Connected) { command = CMDbar.Text; CMDbar.Clear(); cmd.send_data = Encoding.Unicode.GetBytes(command); cmd.client.Send(cmd.send_data); } else { CMD_text.AppendText("client not connected"); } } }
public void callback(string text) { CMD_text.Dispatcher.Invoke(new Action(() => CMD_text.AppendText(text))); CMD_text.Dispatcher.Invoke(new Action(() => CMD_text.ScrollToEnd())); }