void SwipeRecognizer(UISwipeGestureRecognizer x) { if (x.State == UIGestureRecognizerState.Began) { this._swipeStart = x.LocationInView(this).ToPoint(); } if (x.State == UIGestureRecognizerState.Ended) { var endpoint = x.LocationInView(this).ToPoint(); var distance = this._swipeStart.Distance(endpoint); var distanceX = Math.Abs(this._swipeStart.X - endpoint.X); var distanceY = Math.Abs(this._swipeStart.Y - endpoint.Y); var direction = Directionality.None; direction |= ((x.Direction & UISwipeGestureRecognizerDirection.Left) == UISwipeGestureRecognizerDirection.Left ? Directionality.Left : Directionality.None); direction |= ((x.Direction & UISwipeGestureRecognizerDirection.Right) == UISwipeGestureRecognizerDirection.Right ? Directionality.Right : Directionality.None); direction |= ((x.Direction & UISwipeGestureRecognizerDirection.Up) == UISwipeGestureRecognizerDirection.Up ? Directionality.Up : Directionality.None); direction |= ((x.Direction & UISwipeGestureRecognizerDirection.Down) == UISwipeGestureRecognizerDirection.Down ? Directionality.Down : Directionality.None); this.Element.ProcessGesture(new GestureResult { Direction = direction, GestureType = GestureType.Swipe, HorizontalDistance = distanceX, VerticalDistance = distanceY, Origin = _swipeStart, Length = distance, ViewStack = Element.ExcludeChildren ? ViewsContaining(_swipeStart) : null }); } }
private void HandleSwipe(UISwipeGestureRecognizer swipe) { var gestureRecognizers = new List <Tuple <MycoView, IMycoGestureRecognizerController> >(); var location = swipe.LocationInView(Control); (Element as IMycoController).GetGestureRecognizers(new Xamarin.Forms.Point(location.X, location.Y), gestureRecognizers); foreach (var gestureRecognizer in gestureRecognizers) { var swipeGesture = gestureRecognizer.Item2 as IMycoSwipeGestureRecognizerController; if (swipeGesture != null) { switch (swipe.Direction) { case UISwipeGestureRecognizerDirection.Left: swipeGesture.SendSwipeLeft(gestureRecognizer.Item1); break; case UISwipeGestureRecognizerDirection.Right: swipeGesture.SendSwipeRight(gestureRecognizer.Item1); break; } } } }
private void SwipeLeftToRight(UISwipeGestureRecognizer swipeGestureRecognizer) { var point = swipeGestureRecognizer.LocationInView(tableTasks); var indexPath = tableTasks.IndexPathForRowAtPoint(point); taskList.RemoveAt(indexPath.Row); tableTasks.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); }
public void SwipeLefttoRight(UISwipeGestureRecognizer swipeGestureRecognizer) { var point = swipeGestureRecognizer.LocationInView(tableView); var indexPath = tableView.IndexPathForRowAtPoint(point); dbHelper.deleteTask(tableSource.taskList[indexPath.Row]); tableSource.taskList.RemoveAt(indexPath.Row); tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); }
public void SwipeGestureRecognizer(UISwipeGestureRecognizer sender) { TouchPanel.GestureList.Enqueue(new GestureSample(GestureType.Flick, new TimeSpan(_nowUpdate.Ticks), new Vector2(sender.LocationInView(sender.View)), new Vector2(sender.LocationInView(sender.View)), new Vector2(0, 0), new Vector2(0, 0))); }
private void SwipeHandler(UISwipeGestureRecognizer args) { if(args.State == UIGestureRecognizerState.Ended){ // find the cell var swipeLocation = args.LocationInView(_tableView); var index = _tableView.IndexPathForRowAtPoint(swipeLocation); var cell = _tableView.CellAt(index); var view = ((AlertsTableViewCell)cell).ContentView2; if (args.Direction == UISwipeGestureRecognizerDirection.Left) { if(_lastcell != null){ _lastcell.Animate2 (0.2, ()=>AnimateCellRight(_lastcell), ()=>AnimateCellLeft(view)); } _lastcell = view; view.Animate2 (0.2, ()=>AnimateCellLeft(view)); } else if(args.Direction == UISwipeGestureRecognizerDirection.Right){ _lastcell = null; view.Animate2 (0.2, ()=>AnimateCellRight(view)); } } }
public void SwipeGestureRecognizer(UISwipeGestureRecognizer sender) { TouchPanel.GestureList.Enqueue(new GestureSample(GestureType.Flick, new TimeSpan(_nowUpdate.Ticks), new Vector2 (sender.LocationInView (sender.View)), new Vector2 (sender.LocationInView (sender.View)), new Vector2(0,0), new Vector2(0,0))); }
public void SwipeGestureRecognizer(UISwipeGestureRecognizer sender) { var enabledGestures = TouchPanel.EnabledGestures; if ((enabledGestures & GestureType.Flick) != 0) { TouchPanel.GestureList.Enqueue(new GestureSample(GestureType.Flick, new TimeSpan(_now.Ticks), new Vector2 (sender.LocationInView (sender.View)), new Vector2 (sender.LocationInView (sender.View)), new Vector2(0,0), new Vector2(0,0))); } }