public virtual void OnTouchInjected(TouchInjectedEventArgs e) { if (TouchInjected != null) { TouchInjected(this, e); } }
private void TouchInjectionService_TouchInjected(object sender, TouchInjectedEventArgs e) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { List <Point> touchMarkers = new List <Point>(); for (int i = 0, ic = e.PointerTouchInfos.Length; i < ic; i++) { PointerTouchInfo pointerTouchInfo = e.PointerTouchInfos[i]; if (pointerTouchInfo.PointerInfo.PointerFlags.HasFlag(PointerFlags.UP)) { continue; } touchMarkers.Add(new Point ( (((pointerTouchInfo.PointerInfo.PtPixelLocation.X - this.TouchInjectionService.ScreenRect.Left) / this.TouchInjectionService.ScreenRect.Width) * this.CalibrationPanelSize.Width) - _touchMarkerRadius, (((pointerTouchInfo.PointerInfo.PtPixelLocation.Y - this.TouchInjectionService.ScreenRect.Top) / this.TouchInjectionService.ScreenRect.Height) * this.CalibrationPanelSize.Height) - _touchMarkerRadius )); } this.TouchMarkers = touchMarkers; }), DispatcherPriority.Normal); }