diff options
| author | Syndamia <kami02882@gmail.com> | 2019-11-16 20:01:39 +0200 |
|---|---|---|
| committer | Syndamia <kami02882@gmail.com> | 2019-11-16 20:01:39 +0200 |
| commit | d008a57ef8f1b893e3301e2e5b08f1a1f98bc7f1 (patch) | |
| tree | 0f6a47caa5a9b36acce1f2d62ff1c4807695ac28 | |
| parent | 9e0c390b0b6580cde9eae1d791f0acb63be680cc (diff) | |
| download | Shower-d008a57ef8f1b893e3301e2e5b08f1a1f98bc7f1.tar Shower-d008a57ef8f1b893e3301e2e5b08f1a1f98bc7f1.tar.gz Shower-d008a57ef8f1b893e3301e2e5b08f1a1f98bc7f1.zip | |
Fixed issue of Pinger where the proces would continuous running after closing of the window
| -rw-r--r-- | Pinger/Pinger/Form1.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Pinger/Pinger/Form1.cs b/Pinger/Pinger/Form1.cs index 5b4e89b..bf15a8a 100644 --- a/Pinger/Pinger/Form1.cs +++ b/Pinger/Pinger/Form1.cs @@ -12,11 +12,13 @@ using System.Windows.Forms; namespace Pinger { public partial class myNetForm : Form { + private Thread t; + public myNetForm() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; - Thread t = new Thread(PingStatus); + t = new Thread(PingStatus); t.Start(); } @@ -24,7 +26,7 @@ namespace Pinger { Ping p = new Ping(); PingReply pr; - while(true) { + while(!this.IsDisposed) { lblNotifyPingEvent.Visible = true; try { pr = p.Send(cbPingAddress.Text); |
