aboutsummaryrefslogtreecommitdiff
path: root/Pinger/MyNet/Form1.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Pinger/MyNet/Form1.cs')
-rw-r--r--Pinger/MyNet/Form1.cs54
1 files changed, 0 insertions, 54 deletions
diff --git a/Pinger/MyNet/Form1.cs b/Pinger/MyNet/Form1.cs
deleted file mode 100644
index d09d9a1..0000000
--- a/Pinger/MyNet/Form1.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.Threading;
-using System.Net.NetworkInformation;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace MyNet {
- public partial class myNetForm : Form {
- public myNetForm() {
- InitializeComponent();
- Control.CheckForIllegalCrossThreadCalls = false;
-
- Thread t = new Thread(PingStatus);
- t.Start();
- }
-
- private void PingStatus() {
- Ping p = new Ping();
- PingReply pr;
-
- while(true) {
- try {
- pr = p.Send(cbPingAddress.Text);
- lblErrorMessage.Text = "";
-
- if (pr.Status == IPStatus.Success) {
- lblPing.Text = pr.RoundtripTime + "";
-
- if (pr.RoundtripTime > 300) lblPing.BackColor = Color.Red;
- else if (pr.RoundtripTime > 100) lblPing.BackColor = Color.Orange;
- else if (pr.RoundtripTime > 10) lblPing.BackColor = Color.Yellow;
- else lblPing.BackColor = Color.LightGreen;
- }
- else throw new Exception(pr.Status.ToString());
- } catch (Exception ex) {
- lblErrorMessage.Text = ex.Message;
-
- lblPing.BackColor = Color.Red;
- lblPing.Text = "-1";
- }
- Thread.Sleep(1000);
- }
- }
-
- private void Form1_Load(object sender, EventArgs e) {
- }
- }
-}