protected override void OnAttached() { // Get the Android View corresponding to the Element that the effect is attached to view = Control == null ? Container : Control; // Get access to the TouchEffect class in the .NET Standard library SignalRClientSideTutorial01.TouchEffect touchEffect = (SignalRClientSideTutorial01.TouchEffect)Element.Effects. FirstOrDefault(e => e is SignalRClientSideTutorial01.TouchEffect); if (touchEffect != null && view != null) { viewDictionary.Add(view, this); formsElement = Element; libTouchEffect = touchEffect; // Save fromPixels function fromPixels = view.Context.FromPixels; // Set event handler on View view.Touch += OnTouch; } }
public TouchRecognizer(Element element, UIView view, SignalRClientSideTutorial01.TouchEffect touchEffect) { this.element = element; this.view = view; this.touchEffect = touchEffect; viewDictionary.Add(view, this); }
protected override void OnAttached() { // Get the iOS UIView corresponding to the Element that the effect is attached to view = Control == null ? Container : Control; // Uncomment this line if the UIView does not have touch enabled by default //view.UserInteractionEnabled = true; // Get access to the TouchEffect class in the .NET Standard library SignalRClientSideTutorial01.TouchEffect effect = (SignalRClientSideTutorial01.TouchEffect)Element.Effects.FirstOrDefault(e => e is SignalRClientSideTutorial01.TouchEffect); if (effect != null && view != null) { // Create a TouchRecognizer for this UIView touchRecognizer = new TouchRecognizer(Element, view, effect); view.AddGestureRecognizer(touchRecognizer); } }
protected override void OnAttached() { // Get the Windows FrameworkElement corresponding to the Element that the effect is attached to frameworkElement = Control == null ? Container : Control; // Get access to the TouchEffect class in the .NET Standard library effect = (SignalRClientSideTutorial01.TouchEffect)Element.Effects. FirstOrDefault(e => e is SignalRClientSideTutorial01.TouchEffect); if (effect != null && frameworkElement != null) { // Save the method to call on touch events onTouchAction = effect.OnTouchAction; // Set event handlers on FrameworkElement frameworkElement.PointerEntered += OnPointerEntered; frameworkElement.PointerPressed += OnPointerPressed; frameworkElement.PointerMoved += OnPointerMoved; frameworkElement.PointerReleased += OnPointerReleased; frameworkElement.PointerExited += OnPointerExited; frameworkElement.PointerCanceled += OnPointerCancelled; } }