Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ping ping = new Ping();
- //Router 0
- //Ping the Ethernet port
- PingReply pingresult = ping.Send(textBoxRouter0.Text, timeout, buffer, options);
- //If it's a success then..
- if (pingresult.Status.ToString() == "Success")
- {
- //Change the picture of the router to a green one
- pictureBoxRouter0.Image = Properties.Resources.router_online;
- //Ping the Serial port
- PingReply serialAB1 = ping.Send("192.168." + textBoxSerialAB.Text + ".2", timeout);
- //If it's a success or a failure, set the status of the port..
- if (serialAB1.Status.ToString() == "Success") { _statusAB1 = " | UP"; } else { _statusAB1 = " | DOWN"; }
- //Set the ToolTip text based on the results
- toolTip0.SetToolTip(pictureBoxRouter0, "Ethernet: " + textBoxRouter0.Text + " | UP" + Environment.NewLine + "Serial 0: Not needed" + Environment.NewLine + "Serial 1: " + "192.168." + textBoxSerialAB.Text + ".1" + _statusAB1);
- //Print out some basic information in the outputbox
- richTextBoxOutput.Text += "-------------------------------------------";
- richTextBoxOutput.Text += Environment.NewLine + "ROUTER - A";
- richTextBoxOutput.Text += Environment.NewLine;
- richTextBoxOutput.Text += Environment.NewLine + "Ethernet: " + pingresult.Address.ToString();
- richTextBoxOutput.Text += Environment.NewLine + "Serial 0: " + "Not needed";
- richTextBoxOutput.Text += Environment.NewLine + "Serial 1: " + "192.168." + textBoxSerialAB.Text + ".1";
- richTextBoxOutput.Text += Environment.NewLine;
- richTextBoxOutput.Text += Environment.NewLine + "Response time: " + pingresult.RoundtripTime + "ms";
- richTextBoxOutput.Text += Environment.NewLine + "-------------------------------------------";
- }
- //If it's a failure then..
- else
- {
- //Change the picture of the router to a red one
- pictureBoxRouter0.Image = Properties.Resources.router_offline;
- //Ping the Serial port
- PingReply serialAB1 = ping.Send("192.168." + textBoxSerialAB.Text + ".2", timeout);
- //If it's a success or a failure, set the status of the port..
- if (serialAB1.Status.ToString() == "Success") { _statusAB1 = " | UP"; } else { _statusAB1 = " | DOWN"; }
- //Set the ToolTip text based on the results
- toolTip0.SetToolTip(pictureBoxRouter0, "Ethernet: " + textBoxRouter0.Text + " | DOWN" + Environment.NewLine + "Serial 0: " + "Not needed" + Environment.NewLine + "Serial 1: " + "192.168." + textBoxSerialAB.Text + ".1" + _statusAB1);
- }
Advertisement
Add Comment
Please, Sign In to add comment