public void WatchKeyPress() { while (true) { byte key = 1; int result = KmyImporter.ScoutKeyPress(ref key); OnKeyPressByteEvent(key); OnKeyPressStringEvent(key.ToString()); } }
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(); } }