private void OnPointerReleased(DrawingSurfaceManipulationHost sender, PointerEventArgs args) { if (this.PointerReleased != null) { this.PointerReleased(sender, args); } }
private void CoreWindow_PointerEntered(CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { var(originalSource, _) = VisualTreeHelper.HitTest(args.CurrentPoint.Position); // Even if impossible for the Enter, we are fallbacking on the RootElement for safety // This is how UWP behaves: when out of the bounds of the Window, the root element is use. // Note that if another app covers your app, then the OriginalSource on UWP is still the element of your app at the pointer's location. originalSource ??= Windows.UI.Xaml.Window.Current.Content; if (originalSource is null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerEntered ({args.CurrentPoint.Position}) **undispatched**"); } return; } if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerEntered [{originalSource.GetDebugName()}"); } var routedArgs = new PointerRoutedEventArgs(args, originalSource); Raise(Enter, originalSource, routedArgs); }
internal void OnPointerWheelChanged(Windows.UI.Core.PointerEventArgs args) { var(originalSource, _) = HitTest(args); // Even if impossible for the Release, we are fallbacking on the RootElement for safety // This is how UWP behaves: when out of the bounds of the Window, the root element is use. // Note that if another app covers your app, then the OriginalSource on UWP is still the element of your app at the pointer's location. originalSource ??= Windows.UI.Xaml.Window.Current.Content; if (originalSource is null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerPressed ({args.CurrentPoint.Position}) **undispatched**"); } return; } if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerPressed [{originalSource.GetDebugName()}"); } var routedArgs = new PointerRoutedEventArgs(args, originalSource); // Second raise the event, either on the OriginalSource or on the capture owners if any RaiseUsingCaptures(Wheel, originalSource, routedArgs); }
internal void OnPointerCancelled(Windows.UI.Core.PointerEventArgs args) { var(originalSource, _) = HitTest(args); // This is how UWP behaves: when out of the bounds of the Window, the root element is use. // Note that is another app covers your app, then the OriginalSource on UWP is still the element of your app at the pointer's location. originalSource ??= Windows.UI.Xaml.Window.Current.Content; if (originalSource is null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerCancelled ({args.CurrentPoint.Position}) **undispatched**"); } return; } if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerCancelled [{originalSource.GetDebugName()}"); } var routedArgs = new PointerRoutedEventArgs(args, originalSource); RaiseUsingCaptures(Cancelled, originalSource, routedArgs); // Note: No ReleaseCaptures(routedArgs);, the cancel automatically raise it ClearPressedState(routedArgs); }
private void StrokeInput_StrokeStarted(InkStrokeInput sender, PointerEventArgs args) { ClearSelection(); inkCanvas.InkPresenter.UnprocessedInput.PointerPressed -= UnprocessedInput_PointerPressed; inkCanvas.InkPresenter.UnprocessedInput.PointerMoved -= UnprocessedInput_PointerMoved; inkCanvas.InkPresenter.UnprocessedInput.PointerReleased -= UnprocessedInput_PointerReleased; }
private void pointerMoved(CoreWindow sender, PointerEventArgs e) { theEvent.Type = ApplicationEventTypes.MouseMove; var loc = e.CurrentPoint.RawPosition; theEvent.CursorPosition = new Point2((int)loc.X, (int)loc.Y); handleEvent(theEvent); }
internal void OnPointerEntered(Windows.UI.Core.PointerEventArgs args) { var(originalSource, _) = HitTest(args); if (originalSource is ImplicitTextBlock) { global::System.Diagnostics.Debug.WriteLine("Entered"); } // Even if impossible for the Enter, we are fallbacking on the RootElement for safety // This is how UWP behaves: when out of the bounds of the Window, the root element is use. // Note that if another app covers your app, then the OriginalSource on UWP is still the element of your app at the pointer's location. originalSource ??= Windows.UI.Xaml.Window.Current.Content; if (originalSource is null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerEntered ({args.CurrentPoint.Position}) **undispatched**"); } return; } if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerEntered [{originalSource.GetDebugName()}"); } var routedArgs = new PointerRoutedEventArgs(args, originalSource); Raise(Enter, originalSource, routedArgs); }
private void UnprocessedInput_PointerExited(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { if (_isErasing) { args.Handled = true; } _isErasing = false; }
void OnPointerReleased(CoreWindow sender, PointerEventArgs args) { try { gestureRecognizer.ProcessUpEvent(args.CurrentPoint); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("Let's do yet another time warp."); } }
void OnPointerMoved(CoreWindow sender, PointerEventArgs args) { try { gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints()); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("Lets do the time warp again."); } }
void PointerMoved(CoreWindow sender, PointerEventArgs args) { if (args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse) { var tmp = args.CurrentPoint.RawPosition; var dx = tmp.X - buffer.X; var dy = tmp.Y - buffer.Y; Distance += Math.Sqrt(dx * dx + dy * dy); buffer = tmp; } }
private async void Core_PointerMoving(CoreInkIndependentInputSource sender, Windows.UI.Core.PointerEventArgs args) { if (this.Dispatcher != null) { Point point = new Point(args.CurrentPoint.Position.X, args.CurrentPoint.Position.Y); await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { UpdateCurrentPoints(point); }); } }
//Used to check if the pointer is within the bounds of the edit control. //If it is, focus should go to the edit control. If it is outside the bounds //Focus should not be in the edit control. private void Page_PointerPressed(CoreWindow sender, PointerEventArgs args) { Rect _boundingbox = EditControl.GetLayout(); if (_boundingbox.Contains(args.CurrentPoint.Position)) { _textEditContext.InternalSetFocus(); EditControl.Focus(FocusState.Programmatic); } else { _textEditContext.InternalRemoveFocus(); } }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { IsMousePressed = true; var x = args.CurrentPoint.Position.X - (sender.Bounds.Right - sender.Bounds.Left) / 2; var y = (sender.Bounds.Bottom - sender.Bounds.Top) / 2 - args.CurrentPoint.Position.Y; x /= scale; y /= scale; MousePoint = new Point(x, y); Sprite.SendPointerPressed(MousePoint); }
void UpdateIntermediatePoints(PointerEventArgs args) { foreach (var point in args.GetIntermediatePoints()) { if (point.IsInContact) { currentPointsInContact[point.PointerId] = point.Position; } else { currentPointsInContact.Remove(point.PointerId); } } }
internal PointerRoutedEventArgs( Windows.UI.Core.PointerEventArgs pointerEventArgs, UIElement source) : this() { _pointerEventArgs = pointerEventArgs; #if HAS_UNO_WINUI _currentPoint = new PointerPoint(_pointerEventArgs.CurrentPoint); #else _currentPoint = _pointerEventArgs.CurrentPoint; #endif FrameId = pointerEventArgs.CurrentPoint.FrameId; Pointer = GetPointer(pointerEventArgs); KeyModifiers = pointerEventArgs.KeyModifiers; OriginalSource = source; }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { var id = args.CurrentPoint.PointerId; // 需要根据 id 分开多个手指 InkStrokeBuilder.SetDefaultDrawingAttributes(new InkDrawingAttributes() { Color = Colors.Blue, Size = new Size(5, 5) }); _currentPointerList.AddRange(args.GetIntermediatePoints()); _inkStroke = InkStrokeBuilder.CreateStrokeFromInkPoints( _currentPointerList.Select(t => new InkPoint(t.Position, t.Properties.Pressure)), Matrix3x2.Identity); Canvas.Invalidate(); }
/// <summary> /// Invoked on every mouse click, touch screen tap, or equivalent interaction when this /// page is active and occupies the entire window. Used to detect browser-style next and /// previous mouse button clicks to navigate between pages. /// </summary> /// <param name="sender">Instance that triggered the event.</param> /// <param name="e">Event data describing the conditions that led to the event.</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // Ignore button chords with the left, right, and middle buttons if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) return; // If back or foward are pressed (but not both) navigate appropriately bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) RaisePointerGoBackGestured(); if (forwardPressed) RaisePointerGoForwardGestured(); } }
internal void OnPointerExited(Windows.UI.Core.PointerEventArgs args) { // This is how UWP behaves: when out of the bounds of the Window, the root element is use. var originalSource = Windows.UI.Xaml.Window.Current.Content; if (originalSource == null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerExited ({args.CurrentPoint.Position}) Called before window content set."); } return; } var overBranchLeaf = VisualTreeHelper.SearchDownForLeaf(originalSource, _isOver); if (overBranchLeaf is null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerExited ({args.CurrentPoint.Position}) **undispatched**"); } return; } if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerPressed [{overBranchLeaf.GetDebugName()}"); } var routedArgs = new PointerRoutedEventArgs(args, originalSource); Raise(Leave, overBranchLeaf, routedArgs); if (!args.CurrentPoint.IsInContact && (PointerDeviceType)args.CurrentPoint.Pointer.Type == PointerDeviceType.Touch) { // We release the captures on exit when pointer if not pressed // Note: for a "Tap" with a finger the sequence is Up / Exited / Lost, so the lost cannot be raised on Up ReleaseCaptures(routedArgs); } }
internal void OnPointerMoved(Windows.UI.Core.PointerEventArgs args) { var(originalSource, staleBranch) = HitTest(args, _isOver); // This is how UWP behaves: when out of the bounds of the Window, the root element is use. // Note that if another app covers your app, then the OriginalSource on UWP is still the element of your app at the pointer's location. originalSource ??= Windows.UI.Xaml.Window.Current.Content; if (originalSource is null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerMoved ({args.CurrentPoint.Position}) **undispatched**"); } return; } if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerMoved [{originalSource.GetDebugName()}"); } var routedArgs = new PointerRoutedEventArgs(args, originalSource); // First raise the PointerExited events on the stale branch if (staleBranch.HasValue) { Raise(Leave, staleBranch.Value, routedArgs); } // Second (try to) raise the PointerEnter on the OriginalSource // Note: This won't do anything if already over. routedArgs.Handled = false; Raise(Enter, originalSource, routedArgs); // Finally raise the event, either on the OriginalSource or on the capture owners if any routedArgs.Handled = false; RaiseUsingCaptures(Move, originalSource, routedArgs); }
//------------------------------------------------------------------------------ // // VisualProperties.OnPointerPressed // // This method is called when the user touches the screen, taps it with a stylus // or clicks the mouse. // //------------------------------------------------------------------------------ void OnPointerPressed(CoreWindow window, PointerEventArgs args) { Point position = args.CurrentPoint.Position; // // Walk our list of visuals to determine who, if anybody, was selected // foreach (var child in _root.Children) { // // Did we hit this child? // Vector3 offset = child.Offset; Vector2 size = child.Size; if ((position.X >= offset.X) && (position.X < offset.X + size.X) && (position.Y >= offset.Y) && (position.Y < offset.Y + size.Y)) { // // This child was hit. Since the children are stored back to front, // the last one hit is the front-most one so it wins // _currentVisual = child as ContainerVisual; _offsetBias = new Vector2((float)(offset.X - position.X), (float)(offset.Y - position.Y)); } } // // If a visual was hit, bring it to the front of the Z order // if (_currentVisual != null) { ContainerVisual parent = _currentVisual.Parent as ContainerVisual; parent.Children.Remove(_currentVisual); parent.Children.InsertAtTop(_currentVisual); } }
private void pointerPressed(CoreWindow sender, PointerEventArgs e) { if (e.CurrentPoint.Properties.IsLeftButtonPressed) { theEvent.Type = ApplicationEventTypes.LeftMouseDown; leftPointerOn = true; } else if (e.CurrentPoint.Properties.IsMiddleButtonPressed) { theEvent.Type = ApplicationEventTypes.MiddleMouseDown; middlePointerOn = true; } else if (e.CurrentPoint.Properties.IsRightButtonPressed) { theEvent.Type = ApplicationEventTypes.RightMouseDown; rightPointerOn = true; } var loc = e.CurrentPoint.RawPosition; theEvent.CursorPosition = new Point2((int)loc.X, (int)loc.Y); handleEvent(theEvent); }
private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { if (!_isErasing | (bool)btnUndo.IsChecked) { return; } var invalidate = false; foreach (var item in _inkStrokes.ToArray()) { if (item.GetStrokes().First().DrawingAttributes.Kind.ToString() != "Pencil") { continue; } var rect = item.SelectWithLine(_lastpoint, args.CurrentPoint.Position); if (rect.IsEmpty) { continue; } if (rect.Width * rect.Height > 0) { int i = _inkStrokes.IndexOf(item); _inkStrokes.Remove(item); _erasedStrokes.Push(item); _erasedIndices.Push(i); history.Push(_erasedStrokes); invalidate = true; } } _lastpoint = args.CurrentPoint.Position; args.Handled = true; if (invalidate) { DrawingCanvas.Invalidate(); } }
internal void OnPointerReleased(Windows.UI.Core.PointerEventArgs args) { var(originalSource, _) = HitTest(args); var isOutOfWindow = originalSource is null; // Even if impossible for the Release, we are fallbacking on the RootElement for safety // This is how UWP behaves: when out of the bounds of the Window, the root element is use. // Note that if another app covers your app, then the OriginalSource on UWP is still the element of your app at the pointer's location. originalSource ??= Windows.UI.Xaml.Window.Current.Content; if (originalSource is null) { if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerPressed ({args.CurrentPoint.Position}) **undispatched**"); } return; } if (this.Log().IsEnabled(LogLevel.Trace)) { this.Log().Trace($"CoreWindow_PointerPressed [{originalSource.GetDebugName()}"); } var routedArgs = new PointerRoutedEventArgs(args, originalSource); RaiseUsingCaptures(Released, originalSource, routedArgs); if (isOutOfWindow || (PointerDeviceType)args.CurrentPoint.Pointer.Type != PointerDeviceType.Touch) { // We release the captures on up but only after the released event and processed the gesture // Note: For a "Tap" with a finger the sequence is Up / Exited / Lost, so we let the Exit raise the capture lost ReleaseCaptures(routedArgs); } ClearPressedState(routedArgs); }
private void OnCoreWindowPointerReleased(CoreWindow sender, PointerEventArgs args) { if (args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse && !args.CurrentPoint.Properties.IsLeftButtonPressed && !args.CurrentPoint.Properties.IsMiddleButtonPressed && _rightMouseButtonPressed) { OnSwitchGesture(); args.Handled = true; } _rightMouseButtonPressed = false; }
private void CoreWindow_PointerReleased(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { IsMousePressed = false; MousePoint = args.CurrentPoint.Position; Sprite.SendPointerReleased(MousePoint); }
private void OnCoreWindowPointerPressed(CoreWindow sender, PointerEventArgs args) { if (this.IsLightDismissEnabled && this.CanDismiss && this.IsOpen && Window.Current != null && Window.Current.Content != null) { var windowToAppBarTransform = Window.Current.Content.TransformToVisual(this); var appBarPosition = windowToAppBarTransform.TransformPoint(args.CurrentPoint.Position); var appBarBounds = this.GetBoundingRect(this); if (!appBarBounds.Contains(appBarPosition)) { this.IsOpen = false; return; } } if (args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse) { _rightMouseButtonPressed = args.CurrentPoint.Properties.IsRightButtonPressed && !args.CurrentPoint.Properties.IsLeftButtonPressed && !args.CurrentPoint.Properties.IsMiddleButtonPressed; if (_rightMouseButtonPressed) { args.Handled = true; } } }
//------------------------------------------------------------------------------ // // VisualProperties.OnPointerMoved // // This method is called when the user moves their finger, stylus or mouse with // a button pressed over the screen. // //------------------------------------------------------------------------------ void OnPointerMoved(CoreWindow window, PointerEventArgs args) { // // If a visual is selected, drag it with the pointer position and // make it opaque while we drag it // if (_currentVisual != null) { // // Set up the properties of the visual the first time it is // dragged. This will last for the duration of the drag // if (!_dragging) { _currentVisual.Opacity = 1.0f; // // Transform the first child of the current visual so that // the image is rotated // foreach (var child in _currentVisual.Children) { child.RotationAngleInDegrees = 45.0f; child.CenterPoint = new Vector3(_currentVisual.Size.X / 2, _currentVisual.Size.Y / 2, 0); break; } // // Clip the visual to its original layout rect by using an inset // clip with a one-pixel margin all around // var clip = _compositor.CreateInsetClip(); clip.LeftInset = 1.0f; clip.RightInset = 1.0f; clip.TopInset = 1.0f; clip.BottomInset = 1.0f; _currentVisual.Clip = clip; _dragging = true; } Point position = args.CurrentPoint.Position; _currentVisual.Offset = new Vector3((float)(position.X + _offsetBias.X), (float)(position.Y + _offsetBias.Y), 0.0f); } }
//------------------------------------------------------------------------------ // // VisualProperties.OnPointerReleased // // This method is called when the user lifts their finger or stylus from the // screen, or lifts the mouse button. // //------------------------------------------------------------------------------ void OnPointerReleased(CoreWindow window, PointerEventArgs args) { // // If a visual was selected, make it transparent again when it is // released and restore the transform and clip // if (_currentVisual != null) { if (_dragging) { // // Remove the transform from the first child // foreach (var child in _currentVisual.Children) { child.RotationAngle = 0.0f; child.CenterPoint = new Vector3(0.0f, 0.0f, 0.0f); break; } _currentVisual.Opacity = 0.8f; _currentVisual.Clip = null; _dragging = false; } _currentVisual = null; } }
private void Input_PointerMoved(object sender, PointerEventArgs args) { gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints()); args.Handled = true; }
private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs args) { throw new NotImplementedException(); }
/// <summary> /// Wird bei jedem Mausklick, jeder Touchscreenberührung oder einer äquivalenten Interaktion aufgerufen, wenn diese /// Seite aktiv ist und das gesamte Fenster ausfüllt. Wird zum Erkennen von "Weiter"- und "Zurück"-Maustastenklicks /// im Browserstil verwendet, um zwischen Seiten zu navigieren. /// </summary> /// <param name="sender">Instanz, von der das Ereignis ausgelöst wurde.</param> /// <param name="e">Ereignisdaten, die die Bedingungen beschreiben, die zu dem Ereignis geführt haben.</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // Tastenkombinationen mit der linken, rechten und mittleren Taste ignorieren if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) return; // Wenn "Zurück" oder "Vorwärts" gedrückt wird (jedoch nicht gleichzeitig), entsprechend navigieren bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) this.GoBackCommand.Execute(null); if (forwardPressed) this.GoForwardCommand.Execute(null); } }
private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { _lastpoint = args.CurrentPoint.Position; args.Handled = true; _isErasing = true; }
/// <summary> /// Invoked on every mouse click, touch screen tap, or equivalent interaction when this /// page is active and occupies the entire window. Used to detect browser-style next and /// previous mouse button clicks to navigate between pages. /// </summary> /// <param name="sender">Instance that triggered the event.</param> /// <param name="args">Event data describing the conditions that led to the event.</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs args) { var properties = args.CurrentPoint.Properties; // Ignore button chords with the left, right, and middle buttons if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) { return; } // If back or foward are pressed (but not both) navigate appropriately var backPressed = properties.IsXButton1Pressed; var forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { args.Handled = true; if (backPressed) { GoBack(this, new RoutedEventArgs()); } if (forwardPressed) { GoForward(this, new RoutedEventArgs()); } } }
private void StrokeInput_StrokeEnded(Windows.UI.Input.Inking.InkStrokeInput sender, Windows.UI.Core.PointerEventArgs args) { UpdateTime(false, true); }
void OnPointerReleased(CoreWindow sender, PointerEventArgs args) { gestureRecognizer.ProcessUpEvent(args.CurrentPoint); }
// Handle new ink or erase strokes to clean up selection UI. private void StrokeInput_StrokeStarted( InkStrokeInput sender, Windows.UI.Core.PointerEventArgs args) { ClearSelection(); }
private async void Core_PointerReleasing(CoreInkIndependentInputSource sender, Windows.UI.Core.PointerEventArgs args) { if (this.Dispatcher != null) { Point point = new Point(args.CurrentPoint.Position.X, args.CurrentPoint.Position.Y); await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { InkStrokeContainer container = inkCanvas.InkPresenter.StrokeContainer; UpdateCurrentPoints(point); points.Add(currentPoints.ToArray()); }); } }
private async void Core_PointerPressing(CoreInkIndependentInputSource sender, Windows.UI.Core.PointerEventArgs args) { Debug.WriteLine("Core_PointerPressing"); if (this.Dispatcher != null) { Point point = new Point(args.CurrentPoint.Position.X, args.CurrentPoint.Position.Y); await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { currentPoints.Clear(); UpdateCurrentPoints(point); btnClear.Visibility = Visibility.Visible; }); } }
private void StrokeInput_StrokeStarted(InkStrokeInput sender, Windows.UI.Core.PointerEventArgs args) { // Don't perform analysis while a stroke is in progress. dispatcherTimer.Stop(); }
// Call the gesture recognizer when a pointer event occurs void OnPointerPressed(CoreWindow sender, PointerEventArgs args) { gestureRecognizer.ProcessDownEvent(args.CurrentPoint); }
/// <summary> /// Invoqué sur chaque clic de souris, pression d'écran tactile ou interaction équivalente lorsque cette /// page est active et occupe la totalité de la fenêtre. Utilisé pour détecter les clics de souris Suivant et Précédent /// de style navigateur pour naviguer entre les pages. /// </summary> /// <param name="sender">Instance qui a déclenché l'événement.</param> /// <param name="e">Données d'événement décrivant les conditions ayant déclenché l'événement.</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // Ignore les pressions simultanées sur les boutons droit, gauche et central if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) return; // Si les boutons Précédent ou Suivant sont utilisés (mais pas les deux à la fois) navigue en conséquence bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) this.GoBackCommand.Execute(null); if (forwardPressed) this.GoForwardCommand.Execute(null); } }
/// <summary> /// 当此页处于活动状态并占用整个窗口时,在每次鼠标单击、触摸屏点击 /// 或执行等效交互时调用。 用于检测浏览器样式下一页和 /// 上一步鼠标按钮单击以在页之间导航。 /// </summary> /// <param name="sender">触发事件的实例。</param> /// <param name="e">描述导致事件的条件的事件数据。</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // 忽略与鼠标左键、右键和中键的键关联 if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) return; // 如果按下后退或前进(但不是同时),则进行相应导航 bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) this.GoBackCommand.Execute(null); if (forwardPressed) this.GoForwardCommand.Execute(null); } }
private Pointer GetPointer(Windows.UI.Core.PointerEventArgs args) => new Pointer( args.CurrentPoint.PointerId, (PointerDeviceType)args.CurrentPoint.PointerDevice.PointerDeviceType, isInContact: args.CurrentPoint.IsInContact, isInRange: args.CurrentPoint.Properties.IsInRange);
/// <summary> /// Вызывается при каждом щелчке мыши, касании сенсорного экрана или аналогичном действии, если эта /// страница активна и занимает все окно. Используется для обнаружения нажатий мышью кнопок "Вперед" и /// "Назад" в браузере для перехода между страницами. /// </summary> /// <param name="sender">Экземпляр, инициировавший событие.</param> /// <param name="e">Данные события, описывающие условия, которые привели к возникновению события.</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // Пропуск сочетаний кнопок, включающих левую, правую и среднюю кнопки if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) return; // Если нажата кнопка "Назад" или "Вперед" (но не обе), выполняется соответствующий переход bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) this.GoBackCommand.Execute(null); if (forwardPressed) this.GoForwardCommand.Execute(null); } }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { UpdateTrigger(args.CurrentPoint.PointerDevice.PointerDeviceType); }
/// <summary> /// このページがアクティブで、ウィンドウ全体を使用する場合、マウスのクリック、タッチ スクリーンのタップなどの /// 操作で呼び出されます。ページ間を移動するため、マウス ボタンのクリックによるブラウザー スタイルの /// 次に進むおよび前に戻る操作の検出に使用されます。 /// </summary> /// <param name="sender">イベントをトリガーしたインスタンス。</param> /// <param name="e">イベントが発生する条件を説明するイベント データ。</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // 左、右、および中央ボタンを使用したボタン操作を無視します if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) return; // [戻る] または [進む] を押すと適切に移動します (両方同時には押しません) bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) this.GoBackCommand.Execute (null); if (forwardPressed) this.GoForwardCommand.Execute (null); } }
/// <summary> /// Se invoca en cada clic del mouse, punteo en la pantalla táctil o una interacción equivalente cuando esta /// página está activa y ocupa toda la ventana. Se usa para detectar los clics de botón del mouse /// siguiente y anterior del estilo del explorador para navegar entre páginas. /// </summary> /// <param name="sender">Instancia que desencadena el evento.</param> /// <param name="e">Datos de evento que describen las condiciones que dan lugar al evento.</param> private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs e) { var properties = e.CurrentPoint.Properties; // Omitir la presión simultánea de botones con los botones Izquierda, Derecha y Medio if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed || properties.IsMiddleButtonPressed) return; // Si se presiona Repág o Avpág (pero no ambos), navegar adecuadamente bool backPressed = properties.IsXButton1Pressed; bool forwardPressed = properties.IsXButton2Pressed; if (backPressed ^ forwardPressed) { e.Handled = true; if (backPressed) this.GoBackCommand.Execute(null); if (forwardPressed) this.GoForwardCommand.Execute(null); } }
private void OnPointerReleased(CoreWindow window, PointerEventArgs args) { //throw new NotImplementedException(); }
private void coreWindow_PointerMoved(CoreWindow sender, PointerEventArgs args) { PincodeManager.StartIdleTimer(); }
private void Input_PointerReleased(object sender, PointerEventArgs args) { gestureRecognizer.ProcessUpEvent(args.CurrentPoint); args.Handled = true; }
void OnPointerMoved(CoreWindow sender, PointerEventArgs args) { gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints()); }