public void Stop()
 {
     if (thread != null && thread.IsStarted)
     {
         thread.Terminated = true;
         thread.Stop(true, true);
         thread = null;
     }
 }
 public void Start()
 {
     CheckStarted();
     thread = new BackgroundThread(threadName, null, new ThreadStart(ThreadExecute));
     thread.Start();
 }