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 PCL TouchTracking.TouchEffect touchEffect = (TouchTracking.TouchEffect)Element.Effects. FirstOrDefault(e => e is TouchTracking.TouchEffect); if (touchEffect != null && view != null) { viewDictionary.Add(view, this); _formsElement = Element; _pclTouchEffect = touchEffect; // Save fromPixels function _fromPixels = view.Context.FromPixels; // Set event handler on View view.Touch += OnTouch; } }
protected override void OnAttached() { _logger.Log("OnAttached invoked."); // 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 = (TouchTracking.TouchEffect)Element.Effects. FirstOrDefault(e => e is TouchTracking.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; } }
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 TouchTracking.TouchEffect touchEffect = (TouchTracking.TouchEffect)Element.Effects. FirstOrDefault(e => e is TouchTracking.TouchEffect); if (touchEffect != null && view != null) { formsElement = Element; libTouchEffect = touchEffect; // Save fromPixels function fromPixels = view.Context.FromPixels; tapDetector = new InternalGestureDetector { TapAction = motionEvent => { libTouchEffect.OnTapAction(formsElement); }, }; gestureRecognizer = new GestureDetectorCompat(view.Context, tapDetector); // Set event handler on View view.Touch += OnTouch; } }
protected override void OnAttached() { // Get the iOS UIView 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 TouchTracking.TouchEffect effect = (TouchTracking.TouchEffect)Element.Effects.FirstOrDefault( e => e is TouchTracking.TouchEffect); if (effect != null && view != null) { // Create a TouchRecognizer for this UIView touchRecognizer = new TouchRecognizer(Element, view, effect) { ShouldRecognizeSimultaneously = (recognizer, gestureRecognizer) => true, }; view.AddGestureRecognizer(touchRecognizer); touchRecognizer.Enabled = true; tapDetector = new UITapGestureRecognizer(() => { effect.OnTapAction(Element); }) { ShouldRecognizeSimultaneously = (recognizer, gestureRecognizer) => true, }; view.AddGestureRecognizer(tapDetector); tapDetector.Enabled = true; } }
public TouchRecognizer(Element element, UIView view, TouchTracking.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; // Get access to the TouchEffect class in the PCL TouchTracking.TouchEffect effect = (TouchTracking.TouchEffect)Element.Effects.FirstOrDefault(e => e is TouchTracking.TouchEffect); if (effect != null && view != null) { // Create a TouchRecognizer for this UIView touchRecognizer = new TouchRecognizer_IOS(Element, view, effect); view.AddGestureRecognizer(touchRecognizer); } }
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 TouchTracking.TouchEffect effect = (TouchTracking.TouchEffect)Element.Effects.FirstOrDefault(e => e is TouchTracking.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() { // ottiene Windows FrameworkElement corrispondente all'elemento che l'effetto รจ collegato a frameworkElement = Control == null ? Container : Control; // ottiene l'accesso alla classe TouchEffect nella libreria .NET Standard effect = (TouchTracking.TouchEffect)Element.Effects.FirstOrDefault(e => e is TouchTracking.TouchEffect); if (effect != null && frameworkElement != null) { // salva il metodo per chiamare gli eventi di tocco onTouchAction = effect.OnTouchAction; // imposta i gestori eventi in FrameworkElement frameworkElement.PointerEntered += OnPointerEntered; frameworkElement.PointerPressed += OnPointerPressed; frameworkElement.PointerMoved += OnPointerMoved; frameworkElement.PointerReleased += OnPointerReleased; frameworkElement.PointerExited += OnPointerExited; frameworkElement.PointerCanceled += OnPointerCancelled; } }
protected override void OnAttached() { // Get the Windows FrameworkElement corresponding to the Element that the effect is attached to this.frameworkElement = this.Control == null ? this.Container : this.Control; // Get access to the TouchEffect class in the .NET Standard library this.effect = (TouchTracking.TouchEffect) this.Element.Effects. FirstOrDefault(e => e is TouchTracking.TouchEffect); if (this.effect != null && this.frameworkElement != null) { // Save the method to call on touch events this.onTouchAction = this.effect.OnTouchAction; // Set event handlers on FrameworkElement this.frameworkElement.PointerEntered += this.OnPointerEntered; this.frameworkElement.PointerPressed += this.OnPointerPressed; this.frameworkElement.PointerMoved += this.OnPointerMoved; this.frameworkElement.PointerReleased += this.OnPointerReleased; this.frameworkElement.PointerExited += this.OnPointerExited; this.frameworkElement.PointerCanceled += this.OnPointerCancelled; } }
public TouchRecognizer(Element element, UIView view, TouchTracking.TouchEffect touchEffect) { this.element = element; this.view = view; this.touchEffect = touchEffect; }