From d008a57ef8f1b893e3301e2e5b08f1a1f98bc7f1 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 16 Nov 2019 20:01:39 +0200 Subject: Fixed issue of Pinger where the proces would continuous running after closing of the window --- Pinger/Pinger/Form1.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Pinger') 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); -- cgit v1.2.3