public void Close() { if (isOpened) { KmyImporter.KeyboardControl(1); KmyImporter.ClosePort(); if (watcherThread != null) { watcherThread.Abort(); } } }
public void Open(int type) { if (!isOpened) { KmyImporter.OpenPort(port, 9600); KmyImporter.KeyboardControl(type); this.isOpened = true; watcherThread = new Thread(new ThreadStart(WatchKeyPress)); watcherThread.IsBackground = true; watcherThread.Start(); } }