/// <summary> /// Gets BrailleIO_DeviceButtonStates flag int for the released keys. /// </summary> /// <param name="raw">The raw data set containing a key [UP_KEYS].</param> /// <returns>combined BrailleIO_DeviceButtonStates</returns> private BrailleIO_DeviceButtonStates getButtonUpStates(OrderedDictionary raw) { BrailleIO_DeviceButtonStates b = BrailleIO_DeviceButtonStates.None; try { if (raw.Contains(UP_KEYS) && raw[UP_KEYS] is HyperBraille.HBBrailleDis.BrailleDisKeyboard) { HyperBraille.HBBrailleDis.BrailleDisKeyboard allDownKey = (HyperBraille.HBBrailleDis.BrailleDisKeyboard)raw[UP_KEYS]; var buttons = BraillDisButtonInterpreter.toSingleBrailleKeyEventList(allDownKey.AllKeys); switch (type) { case "1": b = getBasicButtonUpStates(buttons); break; default: b = getNewButtonUpStates(buttons); break; } } } catch { } return(b); }
private void BrailleDis_keyStateChangedEvent( BrailleDisKeyboard pressedKeys, BrailleDisKeyboard releasedKeys, BrailleDisKeyboard keyboardState, int timeStampTickCount) { OrderedDictionary raw = new OrderedDictionary(); raw.Add("pressedKeys", pressedKeys); raw.Add("releasedKeys", releasedKeys); raw.Add("keyboardState", keyboardState); raw.Add("timeStampTickCount", timeStampTickCount); raw.Add("allPressedKeys", BraillDisButtonInterpreter.toSingleBrailleKeyEventList(pressedKeys.AllKeys)); raw.Add("allReleasedKeys", BraillDisButtonInterpreter.toSingleBrailleKeyEventList(releasedKeys.AllKeys)); var bs = getButtonStates(raw); fireKeyStateChanged(bs, ref raw); //TODO: map generic buttons! }