public void TranslateTouchEvent(object sender, RawPointsDataMessageEventArgs e) { int releaseCount = e.RawTouchsData.Count(rtd => !rtd.Tip); if (releaseCount != 0) { if (e.RawTouchsData.Count <= _lastPointsCount) { OnTouchUp(e); _lastPointsCount = _lastPointsCount - releaseCount; } return; } if (e.RawTouchsData.Count > _lastPointsCount) { if (TouchCapture.Instance.InputPoints.Any(p => p.Count > 10)) { OnTouchMove(e); return; } _lastPointsCount = e.RawTouchsData.Count; OnTouchDown(e); } else if (e.RawTouchsData.Count == _lastPointsCount) { OnTouchMove(e); } }
private void TranslateTouchEvent(object sender, RawPointsDataMessageEventArgs e) { int releaseCount = e.RawData.Count(rtd => !rtd.Tip); if (releaseCount != 0) { if (e.RawData.Count <= _lastPointsCount) { OnPointUp(new InputPointsEventArgs(e.RawData, Device.Touch)); _lastPointsCount = _lastPointsCount - releaseCount; } return; } if (e.RawData.Count > _lastPointsCount) { if (PointCapture.Instance.InputPoints.Any(p => p.Count > 10)) { OnPointMove(new InputPointsEventArgs(e.RawData, Device.Touch)); return; } _lastPointsCount = e.RawData.Count; OnPointDown(new InputPointsEventArgs(e.RawData, Device.Touch)); } else if (e.RawData.Count == _lastPointsCount) { OnPointMove(new InputPointsEventArgs(e.RawData, Device.Touch)); } }
protected virtual void OnTouchMove(RawPointsDataMessageEventArgs args) { if (TouchMove != null) { TouchMove(this, args); } }
private void MessageWindow_PointsIntercepted(object sender, RawPointsDataMessageEventArgs e) { if (e.RawData.Count == 0) { return; } PointsIntercepted?.Invoke(this, e); }
protected void TouchEventTranslator_TouchMove(object sender, RawPointsDataMessageEventArgs e) { // Only add point if we're capturing if (State == CaptureState.Capturing) { if (_timeoutTimer.Enabled) { _timeoutTimer.Stop(); } AddPoint(e.RawTouchsData); } }
protected async void TouchEventTranslator_TouchUp(object sender, RawPointsDataMessageEventArgs e) { if (State == CaptureState.Capturing) { if (TemporarilyDisableCapture && Mode == CaptureMode.UserDisabled) { TemporarilyDisableCapture = false; ToggleUserDisableTouchCapture(); } await EndCapture(); Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; } }
protected void PointEventTranslator_TouchDown(object sender, RawPointsDataMessageEventArgs e) { // Can we begin a new gesture capture if (State == CaptureState.Ready || State == CaptureState.Capturing) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; // Try to begin capture process, if capture started then don't notify other applications of a Touch event, otherwise do if (!TryBeginCapture(e.RawTouchsData)) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal; } } }
private void TranslateTouchEvent(object sender, RawPointsDataMessageEventArgs e) { if ((e.SourceDevice & Devices.TouchDevice) != 0) { int releaseCount = e.RawData.Count(rtd => rtd.State == 0); if (e.RawData.Count == _lastPointsCount) { if (releaseCount != 0) { OnPointUp(new InputPointsEventArgs(e.RawData, e.SourceDevice)); _lastPointsCount -= releaseCount; return; } OnPointMove(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } else if (e.RawData.Count > _lastPointsCount) { if (releaseCount != 0) { return; } if (PointCapture.Instance.InputPoints.Any(p => p.Count > 10)) { OnPointMove(new InputPointsEventArgs(e.RawData, e.SourceDevice)); return; } _lastPointsCount = e.RawData.Count; OnPointDown(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } else { OnPointUp(new InputPointsEventArgs(e.RawData, e.SourceDevice)); _lastPointsCount = _lastPointsCount - e.RawData.Count > releaseCount ? e.RawData.Count : _lastPointsCount - releaseCount; } } else if (e.SourceDevice == Devices.Pen) { bool release = (e.RawData[0].State & (DeviceStates.Invert | DeviceStates.RightClickButton)) == 0 || (e.RawData[0].State & DeviceStates.InRange) == 0; bool tip = (e.RawData[0].State & (DeviceStates.Eraser | DeviceStates.Tip)) != 0; if (release) { OnPointUp(new InputPointsEventArgs(e.RawData, e.SourceDevice)); _lastPointsCount = 0; return; } var penSetting = AppConfig.PenGestureButton; bool drawByTip = (penSetting & DeviceStates.Tip) != 0; bool drawByHover = (penSetting & DeviceStates.InRange) != 0; if (drawByHover && drawByTip) { if (_lastPointsCount == 1 && SourceDevice == Devices.Pen) { OnPointMove(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } else if (_lastPointsCount >= 0) { _lastPointsCount = 1; OnPointDown(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } } else if (drawByTip) { if (!tip) { if (SourceDevice == Devices.Pen) { OnPointUp(new InputPointsEventArgs(e.RawData, e.SourceDevice)); _lastPointsCount = 0; } return; } if (_lastPointsCount == 1 && SourceDevice == Devices.Pen) { OnPointMove(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } else if (_lastPointsCount >= 0) { _lastPointsCount = 1; OnPointDown(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } } else if (drawByHover) { if (_lastPointsCount == 1 && SourceDevice == Devices.Pen) { if (tip) { OnPointDown(new InputPointsEventArgs(e.RawData, e.SourceDevice)); _lastPointsCount = -1; } else { OnPointMove(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } } else if (_lastPointsCount >= 0) { if (tip) { _lastPointsCount = -1; return; } _lastPointsCount = 1; OnPointDown(new InputPointsEventArgs(e.RawData, e.SourceDevice)); } } } }