示例#1
0
        public void KeyDown(Keys keys)
        {
            if (!keysDown.Contains(keys))
            {
                keysDown.Add(keys);
            }
            // find any hold actions that are valid under the new key arrangement
            foreach (string holdAction in holdActions)
            {
                ActionKeyMapping action = actions[holdAction];
                if (keys == action.MainKey || keys == action.AltKey || keys == action.Modifiers)
                {
                    if (KeyMatch_Combination(action.MainKey, action.AltKey, action.Modifiers))
                    {
                        actionsActiveState[holdAction] = true;

                        if (OnActionStart != null)
                        {
                            ActionHandler dispatch = OnActionStart;
                            dispatch(this, holdAction);
                        }
                    }
                }
            }
        }
示例#2
0
 public void ReleaseKeys()
 {
     keysDown = new List <Keys>();
     foreach (string holdAction in holdActions)
     {
         ActionKeyMapping action = actions[holdAction];
         actionsActiveState[action.Name] = false;
         if (OnActionRelease != null)
         {
             ActionHandler dispatch = OnActionRelease;
             dispatch(this, action.Name);
         }
     }
 }