TouchEffects.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using Xamarin.Forms;
  3. namespace InABox.Mobile
  4. {
  5. public enum TouchActionType
  6. {
  7. Entered,
  8. Pressed,
  9. Moved,
  10. Released,
  11. Exited,
  12. Cancelled
  13. }
  14. public class TouchActionEventArgs : EventArgs
  15. {
  16. public TouchActionEventArgs(long id, TouchActionType type, Point location, bool isInContact)
  17. {
  18. Id = id;
  19. Type = type;
  20. Location = location;
  21. IsInContact = isInContact;
  22. }
  23. public long Id { private set; get; }
  24. public TouchActionType Type { private set; get; }
  25. public Point Location { private set; get; }
  26. public bool IsInContact { private set; get; }
  27. }
  28. public delegate void TouchActionEventHandler(object sender, TouchActionEventArgs args);
  29. public class TouchEffect : RoutingEffect
  30. {
  31. public event TouchActionEventHandler TouchAction;
  32. public TouchEffect() : base("XamarinDocs.TouchEffect")
  33. {
  34. }
  35. public bool Capture { set; get; }
  36. public void OnTouchAction(Element element, TouchActionEventArgs args)
  37. {
  38. TouchAction?.Invoke(element, args);
  39. }
  40. }
  41. }