private void GridGesture(object sender, StylusSystemGestureEventArgs e) { if (e.SystemGesture != SystemGesture.Drag) return; Debug.WriteLine("GridGesture event captured."); var newPoints = e.GetStylusPoints(MainImage); bool isReverse = false; if (newPoints.Count > 0 && _downPoints.Count > 0) { var distX = newPoints[0].X - _downPoints[0].X; var distY = newPoints[0].Y - _downPoints[0].Y; Debug.WriteLine(string.Format("Xoffset: {0}, Yoffset: {1}", distX, distY)); if (Math.Abs(distX) > Math.Abs(distY)) { isReverse = distX < 0; // Horizontal } else { return; // Vertical } } if (isReverse) { PreviousFile(); } else { NextFile(); } }
/// <summary> /// Invoked when an unhandled StylusSystemGesture attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event. /// </summary> /// <param name="e"> /// The <see cref="T:System.Windows.Input.StylusSystemGestureEventArgs" /> that contains the event data. /// </param> protected override void OnStylusSystemGesture(StylusSystemGestureEventArgs e) { base.OnStylusSystemGesture(e); // Debug.WriteLine("OnStylusSystemGesture: " + e.SystemGesture); if (e.SystemGesture == SystemGesture.HoldEnter) { Point p = e.GetPosition(this); this.changeLookAtHandler.Started(new ManipulationEventArgs(p)); this.changeLookAtHandler.Completed(new ManipulationEventArgs(p)); e.Handled = true; } /// DELETED BY SJT FOR .NET 3.5 //if (e.SystemGesture == SystemGesture.TwoFingerTap) //{ // this.ZoomExtents(); // e.Handled = true; //} }
public virtual void OnStylusSystemGesture(object sender, StylusSystemGestureEventArgs e) { }
void BorrowLabelGesture(object sender, StylusSystemGestureEventArgs args) { if (args.SystemGesture != SystemGesture.Tap) { return; } RemoveBorrowLabel(); args.Handled = true; }
/// <summary> /// Virtual method reporting a stylus system gesture /// </summary> protected virtual void OnPreviewStylusSystemGesture(StylusSystemGestureEventArgs e) {}
void ManipulationElement_StylusSystemGesture(object sender, StylusSystemGestureEventArgs e) { foreach (var m in mouseProcessors) { if (e.Handled) break; m.PreprocessStylusSystemGesture(e); } if (!e.Handled) defaultMouseProcessor.OnStylusSystemGesture(sender, e); foreach (var m in mouseProcessors) m.PostprocessStylusSystemGesture(e); }
private void DragSource_PreviewStylusSystemGesture(object sender, StylusSystemGestureEventArgs e) { if (e.SystemGesture == SystemGesture.TwoFingerTap) { // cancel drag operation this.draggedData = null; _ignoreNextTouchDownEvent = true; //Console.WriteLine("preview mouse dbl click, cancel"); } }
public void PreprocessStylusSystemGesture(StylusSystemGestureEventArgs e) { }
void IMouseProcessor2.PostprocessStylusSystemGesture(StylusSystemGestureEventArgs e) => MouseProcessor2?.PostprocessStylusSystemGesture(e);
void PromotePreviewToMain(ProcessInputEventArgs e) { if (!e.StagingItem.Input.Handled) { RoutedEvent eventMain = GetMainEventFromPreviewEvent(e.StagingItem.Input.RoutedEvent); if (eventMain != null) { StylusEventArgs eventArgsPreview = (StylusEventArgs)e.StagingItem.Input; StylusDevice stylusDevice = eventArgsPreview.InputReport.StylusDevice; StylusEventArgs eventArgsMain; if (eventMain == Stylus.StylusDownEvent || eventMain == Stylus.PreviewStylusDownEvent) { StylusDownEventArgs downEventArgsPreview = (StylusDownEventArgs)eventArgsPreview; eventArgsMain = new StylusDownEventArgs(stylusDevice, eventArgsPreview.Timestamp); } else if (eventMain == Stylus.StylusButtonDownEvent || eventMain == Stylus.StylusButtonUpEvent) { StylusButtonEventArgs buttonEventArgsPreview = (StylusButtonEventArgs)eventArgsPreview; eventArgsMain = new StylusButtonEventArgs(stylusDevice, eventArgsPreview.Timestamp, buttonEventArgsPreview.StylusButton); } else if (eventMain != Stylus.StylusSystemGestureEvent) { eventArgsMain = new StylusEventArgs(stylusDevice, eventArgsPreview.Timestamp); } else { StylusSystemGestureEventArgs previewSystemGesture = (StylusSystemGestureEventArgs)eventArgsPreview; eventArgsMain = new StylusSystemGestureEventArgs(stylusDevice, previewSystemGesture.Timestamp, previewSystemGesture.SystemGesture, previewSystemGesture.GestureX, previewSystemGesture.GestureY, previewSystemGesture.ButtonState); } eventArgsMain.InputReport = eventArgsPreview.InputReport; eventArgsMain.RoutedEvent = eventMain; e.PushInput(eventArgsMain, e.StagingItem); } } else { // A TouchDevice is activated before TouchDown and deactivated after TouchUp // But if PreviewStylusUp event is handled by the user, it will // never be promoted to TouchUp event leaving the TouchDevice in inconsistent // active state. Hence deactivating touch device if it is active. StylusEventArgs stylusEventArgs = e.StagingItem.Input as StylusEventArgs; if (stylusEventArgs != null && stylusEventArgs.RoutedEvent == Stylus.PreviewStylusUpEvent && stylusEventArgs.StylusDevice.TouchDevice.IsActive) { stylusEventArgs.StylusDevice.TouchDevice.OnDeactivate(); } } }
private bool IgnoreGestureToMousePromotion(StylusSystemGestureEventArgs gestureArgs, StylusTouchDevice touchDevice) { if (gestureArgs != null && touchDevice.DownHandled) { // If touchDevice's down event is already handled // and if this gesture is a candidate for mouse // left button down promotion, then such a // promotion should be ignored. SystemGesture gesture = gestureArgs.SystemGesture; if (gesture == SystemGesture.Tap || gesture == SystemGesture.Drag) { return true; } } return false; }
void PromoteRawToPreview(RawStylusInputReport report, ProcessInputEventArgs e) { RoutedEvent routedEvent = GetPreviewEventFromRawStylusActions(report.Actions); if (routedEvent != null && report.StylusDevice != null && !report.StylusDevice.IgnoreStroke) { StylusEventArgs args; if (routedEvent != Stylus.PreviewStylusSystemGestureEvent) { if (routedEvent == Stylus.PreviewStylusDownEvent) { args = new StylusDownEventArgs(report.StylusDevice, report.Timestamp); } else { args = new StylusEventArgs(report.StylusDevice, report.Timestamp); } } else { RawStylusSystemGestureInputReport reportSg = (RawStylusSystemGestureInputReport)report; args = new StylusSystemGestureEventArgs(report.StylusDevice, report.Timestamp, reportSg.SystemGesture, reportSg.GestureX, reportSg.GestureY, reportSg.ButtonState); } args.InputReport = report; args.RoutedEvent= routedEvent; e.PushInput(args, e.StagingItem); } }
void BackgroundGesture(object sender, StylusSystemGestureEventArgs args) { if (args.SystemGesture != SystemGesture.Tap) { return; } AnimateOut(); }
void SendLabelGesture(object sender, StylusSystemGestureEventArgs args) { if (args.SystemGesture != SystemGesture.Tap) { return; } SendEMail(); args.Handled = true; }
protected virtual void OnStylusSystemGesture(StylusSystemGestureEventArgs e) { throw new NotImplementedException (); }
private void cProbe_StylusSystemGesture(object sender, StylusSystemGestureEventArgs e) { DisplayEvent("StylusSystemGesture", e.ToText()); }
protected virtual void OnStylusSystemGesture(StylusSystemGestureEventArgs e);
void ImageTapped(object sender, StylusSystemGestureEventArgs args) { if (args.SystemGesture != SystemGesture.Tap) { return; } var publication = publications[(Image)sender]; RaiseEvent(new PublicationSelectedArgs( PublicationCanvas.PublicationSelectedEvent, publication)); }
private void DragSource_StylusSystemGesture(object sender, StylusSystemGestureEventArgs e) { if (e.SystemGesture == SystemGesture.TwoFingerTap) { // cancel drag operation this.draggedData = null; //Console.WriteLine("mouse dbl click, cancel"); } }
protected override void OnStylusSystemGesture(StylusSystemGestureEventArgs e) { base.OnStylusSystemGesture(e); }
/// <summary> /// Invoked when an unhandled StylusSystemGesture attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event. /// </summary> /// <param name="e"> /// The <see cref="T:System.Windows.Input.StylusSystemGestureEventArgs"/> that contains the event data. /// </param> protected override void OnStylusSystemGesture(StylusSystemGestureEventArgs e) { base.OnStylusSystemGesture(e); // Debug.WriteLine("OnStylusSystemGesture: " + e.SystemGesture); if (e.SystemGesture == SystemGesture.HoldEnter) { var p = e.GetPosition(this); this.changeLookAtHandler.Started(new ManipulationEventArgs(p)); this.changeLookAtHandler.Completed(new ManipulationEventArgs(p)); e.Handled = true; } if (e.SystemGesture == SystemGesture.TwoFingerTap) { this.ZoomExtents(); e.Handled = true; } }
void invoker_StylusSystemGesture(object sender, StylusSystemGestureEventArgs e) { this.OnStylusSystemGesture(e); }
private static void OnStylusSystemGestureThunk(object sender, StylusSystemGestureEventArgs e) { Invariant.Assert(!e.Handled, "Unexpected: Event has already been handled."); UIElement uie = sender as UIElement; if (uie != null) { uie.OnStylusSystemGesture(e); } else { ContentElement ce = sender as ContentElement; if (ce != null) { ce.OnStylusSystemGesture(e); } else { ((UIElement3D)sender).OnStylusSystemGesture(e); } } }
/// <summary> /// Stylus system gesture postprocess handler /// </summary> /// <param name="e">Event args</param> public virtual void PostprocessStylusSystemGesture(StylusSystemGestureEventArgs e) { }
/// <summary> /// Virtual method reporting a stylus system gesture /// </summary> protected internal virtual void OnStylusSystemGesture(StylusSystemGestureEventArgs e) {}
private void OnStylusSystemGestureEventArgs(object sender, StylusSystemGestureEventArgs e) { if (!IsSampling(sender)) { return; } _itw.WriteLine(".RaiseStylusSystemGestureEvent({0})", e.RoutedEvent.OwnerType.Name + "." + e.RoutedEvent.Name + "Event"); CodeBox.Text = _sw.ToString(); }