jonassvensson4

Untitled

Apr 18th, 2016
609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 KB | None | 0 0
  1. Ping ping = new Ping();
  2.  
  3. //Router  0
  4. PingReply pingresult = ping.Send(textBoxRouter0.Text, timeout, buffer, options);
  5. if (pingresult.Status.ToString() == "Success")
  6. {
  7.     pictureBoxRouter0.Image = Properties.Resources.router_online;
  8.  
  9.     //A > B
  10.     PingReply serialAB1 = ping.Send("192.168." + textBoxSerialAB.Text + ".2", timeout);
  11.     if (serialAB1.Status.ToString() == "Success") { _statusAB1 = " | UP"; } else { _statusAB1 = " | DOWN"; }
  12.  
  13.     toolTip0.SetToolTip(pictureBoxRouter0, "Ethernet: " + textBoxRouter0.Text + " | UP" + Environment.NewLine + "Serial 0: Not needed" + Environment.NewLine + "Serial 1: " + "192.168." + textBoxSerialAB.Text + ".1" + _statusAB1);
  14.  
  15.     richTextBoxOutput.Text += "-------------------------------------------";
  16.     richTextBoxOutput.Text += Environment.NewLine + "ROUTER - A";
  17.     richTextBoxOutput.Text += Environment.NewLine;
  18.     richTextBoxOutput.Text += Environment.NewLine + "Ethernet: " + pingresult.Address.ToString();
  19.     richTextBoxOutput.Text += Environment.NewLine + "Serial 0: " + "Not needed";
  20.     richTextBoxOutput.Text += Environment.NewLine + "Serial 1: " + "192.168." + textBoxSerialAB.Text + ".1";
  21.     richTextBoxOutput.Text += Environment.NewLine;
  22.     richTextBoxOutput.Text += Environment.NewLine + "Response time: " + pingresult.RoundtripTime + "ms";
  23.     richTextBoxOutput.Text += Environment.NewLine + "-------------------------------------------";
  24. }
  25. else
  26. {
  27.     pictureBoxRouter0.Image = Properties.Resources.router_offline;
  28.  
  29.     //A > B
  30.     PingReply serialAB1 = ping.Send("192.168." + textBoxSerialAB.Text + ".2", timeout);
  31.     if (serialAB1.Status.ToString() == "Success") { _statusAB1 = " | UP"; } else { _statusAB1 = " | DOWN"; }
  32.  
  33.     toolTip0.SetToolTip(pictureBoxRouter0, "Ethernet: " + textBoxRouter0.Text + " | DOWN" + Environment.NewLine + "Serial 0: " + "Not needed" + Environment.NewLine + "Serial 1: " + "192.168." + textBoxSerialAB.Text + ".1" + _statusAB1);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment