Beispiel #1
0
        void UpdateLongCommand()
        {
            _longCommand = AddCommand.GetLongCommand(Element);
            if (_longTapGesture != null)
            {
                _view.RemoveGestureRecognizer(_longTapGesture);
                _longTapGesture.Dispose();
            }
            if (_longCommand == null)
            {
                return;
            }
            _longTapGesture = new UILongPressGestureRecognizer(async(obj) => {
                if (obj.State == UIGestureRecognizerState.Began)
                {
                    _longCommand?.Execute(_longCommandParameter ?? Element);

                    await TapAnimation(0.5, 0, _alpha, false);
                }
                else if (obj.State == UIGestureRecognizerState.Ended ||
                         obj.State == UIGestureRecognizerState.Cancelled ||
                         obj.State == UIGestureRecognizerState.Failed)
                {
                    await TapAnimation(0.5, _alpha, 0);
                }
            });
            _view.AddGestureRecognizer(_longTapGesture);
        }
Beispiel #2
0
        void UpdateLongCommand()
        {
            if (_longCommand != null)
            {
                _longCommand.CanExecuteChanged -= CommandCanExecuteChanged;
            }

            _longCommand = AddCommand.GetLongCommand(Element);

            if (_longTapGesture != null)
            {
                _view.RemoveGestureRecognizer(_longTapGesture);
                _longTapGesture.Dispose();
            }

            if (_longCommand == null)
            {
                return;
            }

            if (_syncCanExecute)
            {
                _longCommand.CanExecuteChanged += CommandCanExecuteChanged;
                CommandCanExecuteChanged(_longCommand, System.EventArgs.Empty);
            }

            _longTapGesture = new UILongPressGestureRecognizer(async(obj) => {
                if (!_longCommand.CanExecute(_longCommandParameter))
                {
                    return;
                }

                if (obj.State == UIGestureRecognizerState.Began)
                {
                    if (_enableSound)
                    {
                        PlayClickSound();
                    }

                    _longCommand?.Execute(_longCommandParameter ?? Element);

                    await TapAnimation(0.5, 0, _alpha, false);
                }
                else if (obj.State == UIGestureRecognizerState.Ended ||
                         obj.State == UIGestureRecognizerState.Cancelled ||
                         obj.State == UIGestureRecognizerState.Failed)
                {
                    await TapAnimation(0.5, _alpha, 0);
                }
            });
            _view.AddGestureRecognizer(_longTapGesture);
        }
Beispiel #3
0
        void UpdateLongCommand()
        {
            if (_longCommand != null) {
                _view.LongClick -= OnLongClick;
            }
            _longCommand = AddCommand.GetLongCommand(Element);
            if (_longCommand == null) {
                return;
            }

            _view.LongClick += OnLongClick;

        }
        void UpdateLongCommand()
        {
            if (_longCommand != null)
            {
                _longCommand.CanExecuteChanged -= CommandCanExecuteChanged;
            }

            _longCommand = AddCommand.GetLongCommand(Element);

            if (_longCommand == null)
            {
                return;
            }

            if (_syncCanExecute)
            {
                _longCommand.CanExecuteChanged += CommandCanExecuteChanged;
                CommandCanExecuteChanged(_longCommand, System.EventArgs.Empty);
            }
        }
Beispiel #5
0
        void UpdateLongCommand()
        {
            if (_longCommand != null)
            {
                _longCommand.CanExecuteChanged -= CommandCanExecuteChanged;
            }

            _longCommand = AddCommand.GetLongCommand(Element);

            if (_longTapGesture != null)
            {
                _view.RemoveGestureRecognizer(_longTapGesture);
                _longTapGesture.Dispose();
            }

            if (_longCommand == null)
            {
                return;
            }

            if (_syncCanExecute)
            {
                _longCommand.CanExecuteChanged += CommandCanExecuteChanged;
                CommandCanExecuteChanged(_longCommand, System.EventArgs.Empty);
            }

            _longTapGesture = new UILongPressGestureRecognizer((obj) => {
                if (!_longCommand.CanExecute(_longCommandParameter))
                {
                    return;
                }

                if (obj.State == UIGestureRecognizerState.Began)
                {
                    _longCommand?.Execute(_longCommandParameter ?? Element);
                }
            });
            _view.AddGestureRecognizer(_longTapGesture);
        }