예제 #1
0
 public void WatchKeyPress()
 {
     while (true)
     {
         byte key    = 1;
         int  result = KmyImporter.ScoutKeyPress(ref key);
         OnKeyPressByteEvent(key);
         OnKeyPressStringEvent(key.ToString());
     }
 }
예제 #2
0
 public void Close()
 {
     if (isOpened)
     {
         KmyImporter.KeyboardControl(1);
         KmyImporter.ClosePort();
         if (watcherThread != null)
         {
             watcherThread.Abort();
         }
     }
 }
예제 #3
0
 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();
     }
 }