private void GestureListener_DragCompleted(object sender, Microsoft.Phone.Controls.DragCompletedGestureEventArgs e) { double startXCoordinate = e.GetPosition(this.MainCanvas).X - e.HorizontalChange; double startYCoordinate = e.GetPosition(this.MainCanvas).Y - e.VerticalChange; Point point = new Point(startXCoordinate, startYCoordinate); Hex startHex = Game.BoardFactory.GetClosestHex(point); Hex targetHex = Game.BoardFactory.GetClosestHex(e.GetPosition(this.MainCanvas)); if (Game.BoardFactory.AllowDragEvent(startHex, targetHex)) { Game.BoardFactory.HandleDragEvent(targetHex); } }
private void GestureListener_Tap(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { if (Game.CurrentViewLevel > 1) { Hex closestHex = Game.BoardFactory.GetClosestHex(e.GetPosition(this.MainCanvas)); Game.BoardFactory.HandleTapEvent(closestHex); } }
private void GestureListener_Hold(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { var pushpinLocation = googlemap.ViewportPointToLocation(e.GetPosition(googlemap)); Pushpin pushpin = new Pushpin { Location = pushpinLocation, Template = Application.Current.Resources["PushpinControlTemplate"] as ControlTemplate, Content = "1" }; if (googlemap.Children.Any(p => p is Pushpin)) googlemap.Children.Remove(googlemap.Children.Single(p => p is Pushpin)); googlemap.Children.Add(pushpin); EnableProceedButton(); }
protected void ScrollViewer_Tapped(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { _offsetAtTap = null; _ignoreDoubleTap = false; if (HideButtonPanel()) { return; } if (App.Settings.IsTapIgnored) { return; } ScrollViewer scrollViewer = (sender as ScrollViewer); scrollViewer.UpdateLayout(); _offsetAtTap = scrollViewer.VerticalOffset; if (scrollViewer != null) { _handleTap = true; Naboo.AppUtil.AsyncCallHelper.DelayCall( () => { _ignoreDoubleTap = true; if (!_handleTap) { return; } try { Point tapPos = e.GetPosition(scrollViewer); if (tapPos.Y < (scrollViewer.ActualHeight / 6)) { scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - (scrollViewer.ActualHeight - 60)); } else if (tapPos.Y > (scrollViewer.ActualHeight * 5 / 6)) { scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + (scrollViewer.ActualHeight - 60)); } } catch (Exception ex) { } }, 300 ); } }
protected void ScrollViewer_DoubleTapped(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { double? offsetAtTap = _offsetAtTap; _handleTap = false; _offsetAtTap = null; if (App.Settings.IsTapIgnored) { return; } if (_ignoreDoubleTap) { return; } ScrollViewer scrollViewer = (sender as ScrollViewer); if (scrollViewer != null) { Point tapPos = e.GetPosition(scrollViewer); if (tapPos.Y < (scrollViewer.ActualHeight / 6)) { scrollViewer.ScrollToVerticalOffset(0); } else if (tapPos.Y > (scrollViewer.ActualHeight * 5 / 6)) { bool foundNextPost = false; //scrollViewer.UpdateLayout(); //_topicBodyPanel.UpdateLayout(); //if (offsetAtTap.HasValue) //{ // offsetAtTap = offsetAtTap.Value + scrollViewer.ActualHeight; //} //else //{ // offsetAtTap = scrollViewer.VerticalOffset + scrollViewer.ActualHeight; //} //foreach (UIElement control in _firstPostControls) //{ // if (_topicBodyPanel.Children.Contains(control)) // { // GeneralTransform transformToVisual = control.TransformToVisual(_topicBodyPanel); // Point controlPos = transformToVisual.Transform(new Point(0, 0)); // if (controlPos.Y > offsetAtTap.Value) // { // scrollViewer.ScrollToVerticalOffset(controlPos.Y); // foundNextPost = true; // break; // } // } //} if (!foundNextPost) { scrollViewer.ScrollToVerticalOffset(double.MaxValue); } } } }
private void myGridGestureListener_DoubleTap(object sender, Microsoft.Phone.Controls.GestureEventArgs e) { var point = e.GetPosition(image); _relativeMidpoint = new Point(point.X / image.ActualWidth, point.Y / image.ActualHeight); var xform = image.TransformToVisual(viewport); _screenMidpoint = xform.Transform(point); if (_coercedScale >= (_minScale * 2.5) || _coercedScale < 0) _coercedScale = _minScale; else _coercedScale *= 1.75; ResizeImage(false); }