/////////////////////////////////////////////////////////////////////// /// <summary> /// Called when Wintab WT_PACKET events are received. /// </summary> /// <param name="sender_I">The EventMessage object sending the report.</param> /// <param name="eventArgs_I">eventArgs_I.Message.WParam contains ID of packet containing the data.</param> public void MyWTPacketEventHandler(Object sender_I, MessageReceivedEventArgs eventArgs_I) { if (m_wtData == null) { return; } if (eventArgs_I.Message.Msg == (Int32)EWintabEventMessage.WT_PACKETEXT) { //Debug.WriteLine("Received WT_PACKETEXT"); WTPKT hCtx = (WTPKT)eventArgs_I.Message.LParam; WTPKT pktID = (WTPKT)eventArgs_I.Message.WParam; WintabPacketExt pktExt = m_wtData.GetDataPacketExt(hCtx, pktID); if (pktExt.pkBase.nContext != mLogContext.HCtx) { throw new Exception("Oops - got a message from unknown context: " + pktExt.pkBase.nContext.ToString()); } if (pktExt.pkBase.nContext == mLogContext.HCtx) { // Call updates on all control types, even though some updates will be NO-OPS // because those controls will not be supported for the tablet. mExtensionControlState.UpdateExpressKey((int)pktExt.pkExpKey.nTablet, (int)pktExt.pkExpKey.nControl, (int)pktExt.pkExpKey.nLocation, pktExt.pkExpKey.nState); mExtensionControlState.UpdateTouchRing((int)pktExt.pkTouchRing.nTablet, (int)pktExt.pkTouchRing.nControl, (int)pktExt.pkTouchRing.nMode, pktExt.pkTouchRing.nPosition); mExtensionControlState.UpdateTouchStrip((int)pktExt.pkTouchStrip.nTablet, (int)pktExt.pkTouchStrip.nControl, (int)pktExt.pkTouchStrip.nMode, pktExt.pkTouchStrip.nPosition); // Refresh all supported controls based on current control state. RefreshControls(); } } }
/////////////////////////////////////////////////////////////////////// /// <summary> /// Called when Wintab WT_PACKET events are received. /// </summary> /// <param name="sender_I">The EventMessage object sending the report.</param> /// <param name="eventArgs_I">eventArgs_I.Message.WParam contains ID of packet containing the data.</param> public void MyWTPacketEventHandler(Object sender_I, MessageReceivedEventArgs eventArgs_I) { if (m_wtData == null) { return; } if (eventArgs_I.Message.Msg == (Int32)EWintabEventMessage.WT_PACKET) { // Handle Pen input here if desired } else if (eventArgs_I.Message.Msg == (Int32)EWintabEventMessage.WT_PACKETEXT) { //Debug.WriteLine("Received WT_PACKETEXT"); WTPKT hCtx = (WTPKT)eventArgs_I.Message.LParam; WTPKT pktID = (WTPKT)eventArgs_I.Message.WParam; WintabPacketExt pktExt = m_wtData.GetDataPacketExt(hCtx, pktID); if (pktExt.pkBase.nContext != mLogContext.HCtx) { throw new Exception("Oops - got a message from unknown context: " + pktExt.pkBase.nContext.ToString()); } if (pktExt.pkBase.nContext == mLogContext.HCtx) { // Sets current control state on all control types, even though some updates will be NO-OPS // because those controls will not be supported for the tablet. UInt32 tabletIndex = (UInt32)pktExt.pkExpKey.nTablet; mExtensionControlState.UpdateExpressKey(tabletIndex, (int)pktExt.pkExpKey.nControl, (int)pktExt.pkExpKey.nLocation, pktExt.pkExpKey.nState); mExtensionControlState.UpdateTouchRing(tabletIndex, (int)pktExt.pkTouchRing.nControl, (int)pktExt.pkTouchRing.nMode, pktExt.pkTouchRing.nPosition); mExtensionControlState.UpdateTouchStrip(tabletIndex, (int)pktExt.pkTouchStrip.nControl, (int)pktExt.pkTouchStrip.nMode, pktExt.pkTouchStrip.nPosition); foreach (var tabletIdx in mTabletList) { if (tabletIdx == tabletIndex) { RefreshControls(tabletIndex, true); // Treat all tablets as attached break; } } } } }