/// <summary> /// Occurs when the stylus touches the digitizer surface. /// Allocate a new array to store the packet data for this stylus. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> public void StylusDown(RealTimeStylus sender, StylusDownData data) { // Allocate an empty array to store the packet data that will be // collected for this stylus. ArrayList collectedPackets = new ArrayList(); // Add the packet data from StylusDown to the array collectedPackets.AddRange(data.GetData()); // Insert the array into a hashtable using the stylus id as a key. myPackets.Add(data.Stylus.Id, collectedPackets); }
/// <summary> /// Occurs when the stylus touches the digitizer surface. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data) { //Debug.WriteLine("StylusDown"); Tablet currentTablet = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId); if (currentTablet.DeviceKind == TabletDeviceKind.Touch) { // The stylus id int stylusId = data.Stylus.Id; // Store the packets in the collected packets List <int> collected = new List <int>(data.GetData()); this.collectedPacketsTable[stylusId] = collected; // Store the tablet properties this.tabletPropertiesTable[stylusId] = sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId); } }
// Copied from the RealTimeStylus InkCollection example from // the Microsoft Tablet PC API Sample Applications collection. /// <summary> /// Occurs when the stylus touches the digitizer surface. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data) { // An inverted stylus is reserved for the eraser. if (data.Stylus.Inverted) { return; } // Ignore if a touch input if (m_TouchSupported) { try { if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch) { return; } } catch { m_TouchSupported = false; } } this.m_Core.StylusDown(data.Stylus.Id, 0, data.GetData(), sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId)); }
// Copied from the RealTimeStylus InkCollection example from // the Microsoft Tablet PC API Sample Applications collection. /// <summary> /// Occurs when the stylus touches the digitizer surface. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data) { // An inverted stylus is reserved for the eraser. if(data.Stylus.Inverted) return; this.m_Core.StylusDown(data.Stylus.Id, 0, data.GetData(), sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId)); }
// Copied from the RealTimeStylus InkCollection example from // the Microsoft Tablet PC API Sample Applications collection. /// <summary> /// Occurs when the stylus touches the digitizer surface. /// Allocate a new array to store the packet data for this stylus. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> void IStylusAsyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data) { // An inverted stylus is reserved for the eraser. if(data.Stylus.Inverted) return; int stylusId = data.Stylus.Id; // Allocate an empty array to store the packet data that will be // collected for this stylus. List<int> collectedPackets = new List<int>(); // Add the packet data from StylusDown to the array collectedPackets.AddRange(data.GetData()); // Insert the array into a hashtable using the stylus id as a key. this.m_PacketsTable[stylusId] = collectedPackets; // Also store the current DrawingAttributes. This is necessary because the default // DynamicRenderer (which will be used in conjunction with the ink stored by this collector) // only updates its DrawingAttributes on StylusDown. this.m_DrawingAttributesTable[stylusId] = this.m_DrawingAttributes; // Increment the current stroke id. int strokeId; if (!this.m_StrokeIdTable.TryGetValue(stylusId, out strokeId)) this.m_StrokeIdTable[stylusId] = (strokeId = 0); else this.m_StrokeIdTable[stylusId] = ++strokeId; // And send the packets to anybody who's listening to the RealTimeInk. using(Synchronizer.Lock(this)) { if(this.RealTimeInkSheetModel != null) { TabletPropertyDescriptionCollection tabletProperties = sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId); this.RealTimeInkSheetModel.OnStylusDown(stylusId, strokeId, data.GetData(), tabletProperties); } } }
// Copied from the RealTimeStylus InkCollection example from // the Microsoft Tablet PC API Sample Applications collection. /// <summary> /// Occurs when the stylus touches the digitizer surface. /// Allocate a new array to store the packet data for this stylus. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> void IStylusAsyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data) { // An inverted stylus is reserved for the eraser. if (data.Stylus.Inverted) { return; } // Ignore if a touch input; if (m_TouchSupported) { try { if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch) { return; } } catch { m_TouchSupported = false; } } int stylusId = data.Stylus.Id; // Allocate an empty array to store the packet data that will be // collected for this stylus. List <int> collectedPackets = new List <int>(); // Add the packet data from StylusDown to the array collectedPackets.AddRange(data.GetData()); // Insert the array into a hashtable using the stylus id as a key. this.m_PacketsTable[stylusId] = collectedPackets; // Also store the current DrawingAttributes. This is necessary because the default // DynamicRenderer (which will be used in conjunction with the ink stored by this collector) // only updates its DrawingAttributes on StylusDown. this.m_DrawingAttributesTable[stylusId] = this.m_DrawingAttributes; // Increment the current stroke id. int strokeId; if (!this.m_StrokeIdTable.TryGetValue(stylusId, out strokeId)) { this.m_StrokeIdTable[stylusId] = (strokeId = 0); } else { this.m_StrokeIdTable[stylusId] = ++strokeId; } // And send the packets to anybody who's listening to the RealTimeInk. using (Synchronizer.Lock(this)) { if (this.RealTimeInkSheetModel != null) { TabletPropertyDescriptionCollection tabletProperties = sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId); this.RealTimeInkSheetModel.OnStylusDown(stylusId, strokeId, data.GetData(), tabletProperties); } } }
// Copied from the RealTimeStylus InkCollection example from // the Microsoft Tablet PC API Sample Applications collection. /// <summary> /// Occurs when the stylus touches the digitizer surface. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data) { // An inverted stylus is reserved for the eraser. if(data.Stylus.Inverted) return; // Ignore if a touch input if (m_TouchSupported) { try { if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Touch) return; } catch { m_TouchSupported = false; } } this.m_Core.StylusDown(data.Stylus.Id, 0, data.GetData(), sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId)); }
/// <summary> /// Occurs when the stylus touches the digitizer surface. /// </summary> /// <param name="sender">The real time stylus associated with the notification</param> /// <param name="data">The notification data</param> void IStylusSyncPlugin.StylusDown(RealTimeStylus sender, StylusDownData data) { //Debug.WriteLine("StylusDown"); Tablet currentTablet = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId); if (currentTablet.DeviceKind == TabletDeviceKind.Touch) { // The stylus id int stylusId = data.Stylus.Id; // Store the packets in the collected packets List<int> collected = new List<int>(data.GetData()); this.collectedPacketsTable[stylusId] = collected; // Store the tablet properties this.tabletPropertiesTable[stylusId] = sender.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId); } }