Esempio n. 1
0
 public virtual void KeyReleased(LKey e)
 {
     if (isLock || isClose || !isLoad)
     {
         return;
     }
     int type = e.GetCode();
     int code = e.GetKeyCode();
     try
     {
         if (useScreenListener)
         {
             foreach (ScreenListener t in screens)
             {
                 t.Released(e);
             }
         }
         this.OnKeyUp(e);
         keyType[type] = false;
         keyButtonReleased = code;
         keyButtonPressed = NO_KEY;
     }
     catch (Exception ex)
     {
         keyButtonPressed = NO_KEY;
         keyButtonReleased = NO_KEY;
         Log.Exception(ex);
     }
 }
Esempio n. 2
0
 public virtual void KeyPressed(LKey e)
 {
     if (isLock || isClose || !isLoad)
     {
         return;
     }
     int type = e.GetCode();
     int code = e.GetKeyCode();
     try
     {
         if (useKeyListener)
         {
             foreach (KeyListener t in keys)
             {
                 t.pressed(e);
             }
         }
         this.OnKeyDown(e);
         keyType[type] = true;
         keyButtonPressed = code;
         keyButtonReleased = NO_KEY;
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
         keyButtonPressed = NO_KEY;
         keyButtonReleased = NO_KEY;
     }
 }
 public override void OnKeyUp(LKey e)
 {
     keySize = keyActions.Size();
     if (keySize > 0)
     {
         int keyCode = e.GetKeyCode();
         for (int i = 0; i < keySize; i++)
         {
             Int32 code = (Int32)keyActions.GetKey(i);
             if (code == keyCode)
             {
                 ActionKey act = (ActionKey)keyActions.GetValue(code);
                 act.Release();
             }
         }
     }
     Release(e);
 }
 public override void OnKeyDown(LKey e)
 {
     int size = keyActions.Size();
     if (size > 0)
     {
         int keyCode = e.GetKeyCode();
         for (int i = 0; i < size; i++)
         {
             Int32 code = (Int32)keyActions.GetKey(i);
             if (code == keyCode)
             {
                 ActionKey act = (ActionKey)keyActions.GetValue(code);
                 act.Press();
             }
         }
     }
     Press(e);
 }