/// <summary> /// Destroy the driver /// </summary> public void DestroyDriver() { ServerForm.LogMessage(0, 0, 0, "DriverHostForm", "Destroy driver method has been called on thread: " + Thread.CurrentThread.ManagedThreadId); ServerForm.DestroyDriver(deviceKey); ServerForm.LogMessage(0, 0, 0, "DriverHostForm", "Destroy driver method completed on thread: " + Thread.CurrentThread.ManagedThreadId); Application.ExitThread(); // Close all forms on this thread, which will also terminate the thread itself }