void OnPanUpdated(object sender, PanUpdatedEventArgs e) { View Content = (View)sender; switch (e.StatusType) { //case GestureStatus.Running: // try // { // translatedX = e.TotalX; // translatedY = e.TotalY; // } // catch (Exception err) // { // System.Diagnostics.Debug.WriteLine("" + err.Message); // } // break; //case GestureStatus.Completed: case GestureStatus.Running: try { translatedX = e.TotalX; translatedY = e.TotalY; } catch (Exception err) { System.Diagnostics.Debug.WriteLine("" + err.Message); } System.Diagnostics.Debug.WriteLine("translatedX : " + translatedX); System.Diagnostics.Debug.WriteLine("translatedY : " + translatedY); if (translatedX < 0 && Math.Abs(translatedX) > Math.Abs(translatedY)) { mISwipeCallback.onLeftSwipe(Content, translatedX, translatedY); } else if (translatedX > 0 && translatedX > Math.Abs(translatedY)) { mISwipeCallback.onRightSwipe(Content, translatedX, translatedY); } else if (translatedY < 0 && Math.Abs(translatedY) > Math.Abs(translatedX)) { mISwipeCallback.onTopSwipe(Content, translatedX, translatedY); } else if (translatedY > 0 && translatedY > Math.Abs(translatedX)) { mISwipeCallback.onBottomSwipe(Content, translatedX, translatedY); } else { mISwipeCallback.onNothingSwiped(Content, translatedX, translatedY); } break; } }
void OnPanUpdated(object sender, PanUpdatedEventArgs e) { View Content = (View)sender; switch (e.StatusType) { case GestureStatus.Running: try { /* * double x = 0; * if (translatedX > e.TotalX) x = translatedX - e.TotalX; * else if (translatedX < e.TotalX) x = - translatedX + e.TotalX; */ translatedX = e.TotalX; translatedY = e.TotalY; //Content.TranslateTo(x, Content.AnchorY, 1, null); //Content.TranslationX = x; } catch (Exception err) { System.Diagnostics.Debug.WriteLine("" + err.Message); } break; case GestureStatus.Completed: System.Diagnostics.Debug.WriteLine("translatedX : " + translatedX); System.Diagnostics.Debug.WriteLine("translatedY : " + translatedY); if (translatedX < 0 && Math.Abs(translatedX) > Math.Abs(translatedY)) { mISwipeCallback.onLeftSwipe(Content, param); } else if (translatedX > 0 && translatedX > Math.Abs(translatedY)) { mISwipeCallback.onRightSwipe(Content, param); } else if (translatedY < 0 && Math.Abs(translatedY) > Math.Abs(translatedX)) { mISwipeCallback.onTopSwipe(Content, param); } else if (translatedY > 0 && translatedY > Math.Abs(translatedX)) { mISwipeCallback.onBottomSwipe(Content, param); } else { mISwipeCallback.onNothingSwiped(Content, param); } break; } }
void HandlePanUpdated(object sender, PanUpdatedEventArgs e) { View content = (View)sender; switch (e.StatusType) { case GestureStatus.Running: try { translatedX = e.TotalX; translatedY = e.TotalY; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } break; case GestureStatus.Completed: if (translatedX < 0 && Math.Abs(translatedX) > Math.Abs(translatedY)) { mISwipeCallback.onLeftSwipe(content); } else if (translatedX > 0 && translatedX > Math.Abs(translatedY)) { mISwipeCallback.onRightSwipe(content); } else if (translatedY < 0 && Math.Abs(translatedY) > Math.Abs(translatedX)) { mISwipeCallback.onTopSwipe(content); } else if (translatedY > 0 && translatedY > Math.Abs(translatedX)) { mISwipeCallback.onBottomSwipe(content); } else { mISwipeCallback.onNothingSwiped(content); } break; } }