private void startClick(object sender, RoutedEventArgs e) { try { server = new ServerPart(Convert.ToInt32(portBox.Text)); listen = new Thread(new ThreadStart(server.ServerWork)); listen.Start(); this.chatInfo.AppendText("Server waiting for connecting...\r"); } catch (Exception ex) { server.Disconnect(); chatInfo.AppendText(String.Format("Can not start server work. {0}", ex.Message)); } }
private void finishClick(object sender, RoutedEventArgs e) { server.Disconnect(); this.Close(); Environment.Exit(0); }