public MainWindow(string Host, string Name) { InitializeComponent(); TCP = new MyEasyTCP(Constants.BufferSize); TCP.OnData += TCP_OnData; TCP.OnClosed += TCP_OnClosed; TCP.Connect(new TcpClient(Host, PORT), 1, 0); TCP.Send(0, Name); Title = Name; Closed += (s, e) => TCP.SendCloseRequest(); }
private void bSend_OnClick(object sender, RoutedEventArgs e) { TCP.Send(1, tbMsg.Text); tbMsg.Text = ""; }