private void CoreWindow_PointerMoved(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { playbackcontrolsholder.Visibility = Visibility.Visible; header.Visibility = Visibility.Visible; _timer.Stop(); _timer.Start(); }
/// <summary> /// save pointer state from PointerEventArgs /// </summary> /// <param name="e"></param> /// <returns></returns> public static PointerState _(Windows.UI.Core.PointerEventArgs e, object sender, string remarks) { var ret = new PointerState { Sender = sender, Remarks = remarks, Position = ScreenPos.From(e.CurrentPoint.Position.X, e.CurrentPoint.Position.Y), WheelDelta = e.CurrentPoint.Properties.MouseWheelDelta, Time = DateTime.Now, IsInContact = e.CurrentPoint.IsInContact, IsKeyControl = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Control) != 0, IsKeyMenu = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Menu) != 0, IsKeyShift = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Shift) != 0, IsKeyWindows = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Windows) != 0, }; switch (e.CurrentPoint.PointerDevice.PointerDeviceType) { case PointerDeviceType.Mouse: ret.DeviceType = PointerState.DeviceTypes.Mouse; break; case PointerDeviceType.Pen: ret.DeviceType = PointerState.DeviceTypes.Pen; break; default: ret.DeviceType = PointerState.DeviceTypes.Touch; break; } return(ret); }
private void Select_Moved(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { if (isMooving) { if (lastPoint.X == -10000 && lastPoint.Y == -10000) { lastPoint = args.CurrentPoint.RawPosition; } else { Point newPoint = args.CurrentPoint.RawPosition; if (selectionCanvas.Children.Any()) { selectionCanvas.Children.Clear(); boundingRect = Rect.Empty; } boundingRect = canvas.InkPresenter.StrokeContainer.MoveSelected(new Point(newPoint.X - lastPoint.X, newPoint.Y - lastPoint.Y)); Select_Draw_Bounds(); lastPoint = newPoint; } } else { lasso.Points.Add(args.CurrentPoint.RawPosition);; } }
void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { if (args.CurrentPoint.Properties.IsRightButtonPressed) { BottomAppBar.IsOpen = !BottomAppBar.IsOpen; } }
/// <summary> /// [DONW-2] On Pointer Pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// by Finger / Click /// </remarks> private void OnPointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs e) { var po = _(e, this, "OnPointerPressed"); FingerCount++; po.FingerCount = FingerCount; Move = po.Clone(); //Debug.WriteLine(___(po)); if (po.DeviceType == PointerState.DeviceTypes.Mouse) { StartPosition = po.Position; po.PositionOrigin = StartPosition; KickPointerEvent("OnPointerPressed", fc => fc.OnPointerPressed(po)); } else { if (IsOnManipulationStarted) { IsWaitingManipulationDelta = true; _2ndFingerLostFollow?.Stop(); _2ndFingerLostFollow = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100), }; _2ndFingerLostFollow.Tick += _2ndFingerLostFollow_Tick; StateAtPressed = po.Clone(); _2ndFingerLostFollow.Start(); } } IsOnPointerPressed = true; }
void CoreWindow_PointerMoved(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { var cpt = args.CurrentPoint.Position; VerticalSpeed = SpeedFromLength((int)(cpt.Y - _pressedPoint.Y)); HorizontalSpeed = SpeedFromLength((int)(cpt.X - _pressedPoint.X)); }
/// <summary> /// [UP-1] On Pointer Released /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// by Finger /// by OnPointerPressed /// The last trigger when there is no "OnManipulationStarted" /// </remarks> private void OnPointerReleased(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs e) { var po = _(e, this, "OnPointerReleased"); FingerCount--; po.FingerCount = FingerCount; //Debug.WriteLine(___(po)); if (IsOnManipulationInertiaStarting == false) // otherwise, waiting OnManipulationCompleted { if (po.DeviceType == PointerState.DeviceTypes.Mouse) { KickPointerEvent("OnPointerReleased", fc => fc.OnPointerReleased(po)); } else { if (IsOnPointerPressed && IsOnManipulationStarted == false) // One Finger Tap { po.PositionOrigin = po.Position; po.FingerCount++; po.IsInContact = true; KickPointerEvent("OnPointerPressed", fc => fc.OnPointerPressed(po)); // Fire virtual press event po.FingerCount--; po.IsInContact = false; KickPointerEvent("OnPointerReleased", fc => fc.OnPointerReleased(po)); } } } }
private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { selectionPolylinePoints = new List <Point>(); selectionPolylinePoints.Add(args.CurrentPoint.RawPosition); canvasControl.Invalidate(); }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); //Select Ink boundingRect = inkCanvas.InkPresenter.StrokeContainer.SelectWithPolyLine(lasso.Points); DrawBoundingRect(); }
/// <summary> /// [OTHER] /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPointerWheelChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs e) { var po = _(e, this, "OnPointerWheelChanged"); po.FingerCount = FingerCount; //Debug.WriteLine(___(po)); KickWheelEvent("OnPointerWheelChanged", fc => fc.OnMouseWheelChanged(po)); }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { if (args.CurrentPoint.Properties.IsXButton1Pressed) { Data.OverAll.TheMainPage.GoBack(); } bool forward = args.CurrentPoint.Properties.IsXButton2Pressed; }
public static void AutoHider_PointerUsed(Windows.UI.Core.CoreWindow core, Windows.UI.Core.PointerEventArgs e) { if (Window.Current.CoreWindow.PointerCursor == null) { Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 0); } timer.Stop(); timer.Start(); }
private void StrokeInput_StrokeStarted(InkStrokeInput sender, Windows.UI.Core.PointerEventArgs args) { IReadOnlyList <InkStroke> currentStrokes = inkCanvas.InkPresenter.StrokeContainer.GetStrokes(); foreach (InkStroke inkStroke in currentStrokes) { _core.InkPath(inkStroke.GetInkPoints()); } inkCanvas.InkPresenter.StrokeContainer.Clear(); }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { selectionPolylinePoints.Add(args.CurrentPoint.RawPosition); selectionBoundingRect = inkManager.SelectWithPolyLine(selectionPolylinePoints); selectionPolylinePoints = null; canvasControl.Invalidate(); }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { if (args.CurrentPoint.Properties.IsLeftButtonPressed) { MouseDown[0] = true; } if (args.CurrentPoint.Properties.IsRightButtonPressed) { MouseDown[1] = true; } }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { try { interactionSource.TryRedirectForManipulation(args.CurrentPoint); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { Flower flower = new Flower(); flower.LocationX = args.CurrentPoint.Position.X - flower.Width / 2; // Kukka tulee juuri hiiren kursorin kohdalle flower.LocationY = args.CurrentPoint.Position.Y - flower.Width / 2; // Add to Canvas, lisätään kukka näytölle MyCanvas.Children.Add(flower); flower.SetLocation(); // Add to flowers list, lisätään kukkalistaan flowers.Add(flower); }
//Load audio to use when collision happens private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { Flower flower = new Flower(); flower.LocationX = args.CurrentPoint.Position.X - flower.Width / 2; flower.LocationY = args.CurrentPoint.Position.Y - flower.Height / 2; // add to canvas MyCanvas.Children.Add(flower); flower.SetLocation(); // add to flowers list flowers.Add(flower); }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { Tellu tellu = new Tellu(); tellu.LocationX = args.CurrentPoint.Position.X - tellu.Width / 2; tellu.LocationY = args.CurrentPoint.Position.Y - tellu.Width / 2; MyCanvas.Children.Add(tellu); tellu.SetLocation(); tellut.Add(tellu); }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { Bomb bomb = new Bomb(); bomb.LocationX = args.CurrentPoint.Position.X - bomb.Width / 2; bomb.LocationY = args.CurrentPoint.Position.Y - bomb.Width / 2; // add to canvas myCanvas.Children.Add(bomb); bomb.SetLocation(); // add bombs list bombs.Add(bomb); CheckCollision(bomb); }
void OnPointerReleased(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { for (int i = 0; i < _pointerStates.Count; i++) { PointerState state = _pointerStates[i]; if (state.pointerId == args.CurrentPoint.PointerId) { state.pointerPoint = args.CurrentPoint; UpdateInputCoordinates(i == 0 ? NativeActionPointer1Up : NativeActionPointer2Up); _pointerStates.RemoveAt(i); break; } } }
void OnPointerMoved(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { for (int i = 0; i < _pointerStates.Count; i++) { PointerState state = _pointerStates[i]; if (state.pointerId == args.CurrentPoint.PointerId) { state.pointerPoint = args.CurrentPoint; _pointerStates[i] = state; UpdateInputCoordinates(NativeActionMove); break; } } }
private void CoreWindow_PointerReleased(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { if (args.CurrentPoint.Properties.PointerUpdateKind == Windows.UI.Input.PointerUpdateKind.RightButtonReleased) { if (bottomCommandBar.ClosedDisplayMode == AppBarClosedDisplayMode.Minimal) { bottomCommandBar.ClosedDisplayMode = AppBarClosedDisplayMode.Hidden; } else { bottomCommandBar.ClosedDisplayMode = AppBarClosedDisplayMode.Minimal; } } }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { // create new flower Flower flower = new Flower(); // set location with mouse location flower.LocationX = args.CurrentPoint.Position.X - flower.Width / 2; flower.LocationY = args.CurrentPoint.Position.Y - flower.Height / 2; // add to game canvas MyCanvas.Children.Add(flower); // set flower location in canvas flower.SetLocation(); // add to flowers list (for collision checking) flowers.Add(flower); }
void CoreWindow_PointerWheelChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { if (args.KeyModifiers != Windows.System.VirtualKeyModifiers.Control) { return; } if (args.CurrentPoint.Properties.MouseWheelDelta < 0) { //下一日 } else { //上一日 } }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { // create a new food Superfood superfood = new Superfood(); // set location with mouse position superfood.LocationX = args.CurrentPoint.Position.X - superfood.Width / 2; superfood.LocationY = args.CurrentPoint.Position.Y - superfood.Height / 2; // add to game canvas MyCanvas.Children.Add(superfood); // set food location in canvas superfood.SetLocation(); // add to foods list (for collision checking) superfoods.Add(superfood); }
private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { lasso = new Polyline() { Stroke = new SolidColorBrush(Windows.UI.Colors.Red), StrokeThickness = 2, StrokeDashArray = new DoubleCollection() { 2, 2 } }; lasso.Points.Add(args.CurrentPoint.RawPosition); ShapesCanvas.Children.Add(lasso); }
private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, Windows.UI.Core.PointerEventArgs args) { lasso.Points.Add(args.CurrentPoint.RawPosition); List <Line> linesToAdd = new List <Line>(); foreach (Line line in ShapesCanvas.Children.OfType <Line>()) { bool LineIntersection = false; bool SegmentIntersection = false; PointF IntersectionPoint; PointF p2; PointF p3; FindIntersection( // The line in the canvas new PointF((float)line.X1, (float)line.Y1), new PointF((float)line.X2, (float)line.Y2), // The 'cutting line' new PointF((float)lasso.Points.First().X, (float)lasso.Points.First().Y), new PointF((float)lasso.Points.Last().X, (float)lasso.Points.Last().Y), out LineIntersection, // Indicate if there is an intersection out SegmentIntersection, // The intersection point out IntersectionPoint, out p2, out p3); if (SegmentIntersection) { List <Line> lines = CutTheLine(line, IntersectionPoint); linesToAdd.AddRange(lines); } } foreach (Line line in linesToAdd) { ShapesCanvas.Children.Add(line); } ShapesCanvas.Children.Remove(lasso); }
private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { // jos kaikkia pommeja ei ole käytetty luodaan lisää hiirenpainalluksella, vähennetään käytettävien määrästä ja tarkistetaan osuma if (BombsLeft > 0) { Bomb bomb = new Bomb(); bomb.LocationX = args.CurrentPoint.Position.X - bomb.Width / 2; bomb.LocationY = args.CurrentPoint.Position.Y - bomb.Width / 2; myCanvas.Children.Add(bomb); bomb.SetLocation(); bombs.Add(bomb); BombsLeft--; bombsBlock.Text = BombsLeft.ToString(); CheckCollision(bomb); } }
void OnPointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args) { for (int i = 0; i < _pointerStates.Count; i++) { if (_pointerStates[i].pointerId == args.CurrentPoint.PointerId) { _pointerStates.RemoveAt(i); break; } } PointerState state; state.pointerId = args.CurrentPoint.PointerId; state.pointerPoint = args.CurrentPoint; _pointerStates.Add(state); UpdateInputCoordinates(_pointerStates.Count > 1 ? NativeActionPointer2Down : NativeActionPointer1Down); }