Guest User

Untitled

a guest
Jun 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. // start up the WPF application
  2. // set the handler for the Checked event
  3. ToggleButton channelButton1 = new ToggleButton();
  4. channelButton1.Checked += (s, e) =>
  5. ThreadPool.QueueUserWorkItem(SetTcpChannel, 1);
  6.  
  7. try
  8. {
  9. int channel = (int)state;
  10. EnsureTcpSocket();
  11. // more logic to do stuff with channel
  12. // that we don't care about for SO
  13. ...
  14. }
  15. catch (Exception e)
  16. {
  17. // just for illustration
  18. // this is where I expected the code to return
  19. ...
  20. }
  21.  
  22. if (_tcp == null)
  23. {
  24. // this is not a valid ip/port since the
  25. // target machine is not running (test condition)
  26. // but that's ok, I should get some exception
  27. // and continue debugging...right?
  28. _tcp = new TcpClient(ip, port);
  29. }
Add Comment
Please, Sign In to add comment