Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. using Foundation;
  7. using UIKit;
  8. using Xamarin.Forms;
  9. using APPChamada.Class;
  10. using APPChamada.iOS.Class;
  11. using Xamarin.Forms.Platform.iOS;
  12. using System.ComponentModel;
  13.  
  14. [assembly: ExportRenderer(typeof(BoxViewWithLongPressGesture), typeof(LongPressGestureRecognizerBoxViewRenderer))]
  15. namespace APPChamada.iOS.Class
  16. {
  17.     class LongPressGestureRecognizerBoxViewRenderer : BoxRenderer
  18.     {
  19.  
  20.         public double TotalX { set; get; }
  21.  
  22.         public double TotalY { set; get; }
  23.  
  24.         public GestureStatusCustom StatusType { get; set; }
  25.  
  26.         public event EventHandler PanUpdated;
  27.  
  28.         PanGestureRecognizerCustomiOS GesturePan = new PanGestureRecognizerCustomiOS();
  29.  
  30.         public static void Init()
  31.         {
  32.  
  33.         }
  34.        
  35.         private void InvokeHandlerPanUpDate()
  36.         {
  37.             PanUpdated?.Invoke((object)this, EventArgs.Empty);
  38.         }
  39.  
  40.         public LongPressGestureRecognizerBoxViewRenderer()
  41.         {
  42.             this.UserInteractionEnabled = true;
  43.  
  44.             this.AddGestureRecognizer(new UILongPressGestureRecognizer((longPress) => {
  45.  
  46.                 if (longPress.State == UIGestureRecognizerState.Began)
  47.                 {
  48.                     Console.WriteLine("Deseja excluir o registro?");
  49.                 }
  50.             }));
  51.  
  52.             this.AddGestureRecognizer(GesturePan);
  53.             GesturePan.PanUpdated += (y, n) =>
  54.             {
  55.                 Refresh();
  56.             };
  57.         }
  58.  
  59.         private void Refresh()
  60.         {
  61.             TotalX = GesturePan.TotalX;
  62.             TotalY = GesturePan.TotalY;
  63.             StatusType = GesturePan.StatusType;
  64.             InvokeHandlerPanUpDate();
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement