Ejemplo n.º 1
0
        protected override void OnAttached()
        {
            isCanTouch       = Touch.GetIsEnabled(Element);
            commandStartTap  = Touch.GetStartTap(Element);
            commandFinishTap = Touch.GetFinishTap(Element);
            commandTap       = Touch.GetTap(Element);
            commandLongTap   = Touch.GetLongTap(Element);
            longTapLatency   = Touch.GetLongTapLatency(Element);
            gestureTap       = new GestureTouchSam(OnTap);
            gestureTap.MinimumPressDuration = 0;
            gestureTap.ShouldReceiveTouch  += (UIGestureRecognizer g, UITouch t) =>
            {
                return(true);
            };
            gestureTap.ShouldRecognizeSimultaneously += (UIGestureRecognizer g, UIGestureRecognizer t) =>
            {
                return(true);
            };

            if (commandLongTap != null)
            {
                TimerInit();
            }

            View.UserInteractionEnabled = true;
            View.AddGestureRecognizer(gestureTap);

            UpdateEffectColor();
        }
Ejemplo n.º 2
0
        private void OnFinishTapped()
        {
            var cmd   = Touch.GetFinishTap(Element);
            var param = Touch.GetFinishTapParameter(Element);

            if (cmd?.CanExecute(param) ?? false)
            {
                cmd.Execute(param);
            }
        }
Ejemplo n.º 3
0
        private void FinishTap()
        {
            var cmd   = Touch.GetFinishTap(Element);
            var param = Touch.GetFinishTapParameter(Element);

            if (cmd == null)
            {
                return;
            }

            if (cmd.CanExecute(param))
            {
                cmd.Execute(param);
            }
        }
Ejemplo n.º 4
0
        protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(e);

            if (e.PropertyName == Touch.IsEnabledProperty.PropertyName)
            {
                isCanTouch = Touch.GetIsEnabled(Element);
            }
            else if (e.PropertyName == Touch.ColorProperty.PropertyName)
            {
                UpdateEffectColor();
            }
            else if (e.PropertyName == Touch.TapProperty.PropertyName)
            {
                commandTap = Touch.GetTap(Element);
            }
            else if (e.PropertyName == Touch.StartTapProperty.PropertyName)
            {
                commandStartTap = Touch.GetStartTap(Element);
            }
            else if (e.PropertyName == Touch.FinishTapProperty.PropertyName)
            {
                commandFinishTap = Touch.GetFinishTap(Element);
            }
            else if (e.PropertyName == Touch.LongTapProperty.PropertyName)
            {
                commandLongTap = Touch.GetLongTap(Element);
                if (commandLongTap == null)
                {
                    TimerDispose();
                }
                else
                {
                    TimerInit();
                }
            }
            else if (e.PropertyName == Touch.LongTapLatencyProperty.PropertyName)
            {
                longTapLatency = Touch.GetLongTapLatency(Element);
            }
        }