Пример #1
0
        public override bool HandleWidgetTouched(INavigator navigator, MPoint position)
        {
            var args = new HyperlinkWidgetArguments();

            Touched?.Invoke(this, args);

            return(args.Handled);
        }
Пример #2
0
 private void Pin_ValueChanged(object sender, GpioPinValueChangedEventArgs e)
 {
     if (e.Edge == GpioPinEdge.RisingEdge)
     {
         Touched?.Invoke();
     }
     else
     {
         Untouched?.Invoke();
     }
 }
Пример #3
0
        /// <summary>
        /// Toucheses the began.
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            // Get the current touch
            var touch = touches.AnyObject as UITouch;

            if (touch != null)
            {
                Touched?.Invoke(this, new CGPoint(touch.LocationInView(WindowView).X, touch.LocationInView(WindowView).Y));
            }
        }
Пример #4
0
        public void SendTouched(Xamarin.Forms.VisualElement visualElement, TouchEventArgs args)
        {
            Debug.WriteLine($"State {args.TouchState} on {visualElement.GetHashCode()} with {args.TouchPoints.Count} Fingers");
            VisualStateManager.GoToState(visualElement, args.TouchState.ToString());
            Touched?.Invoke(visualElement, args);

            if (!(visualElement is View view))
            {
                return;
            }

            foreach (var gesture in view.GestureRecognizers.Where(x => x.Is <TouchGestureRecognizer>()))
            {
                var touchGesture = gesture as TouchGestureRecognizer;
                touchGesture?.SendTouched(view, args);
            }
        }
Пример #5
0
        private void OnTouched(BaseEventData eventData)
        {
            //If we are dragging, no touch event, we don't want conflicts, drag has more priority than touch
            if (_isDragging)
            {
                return;
            }

            var input = eventData.currentInputModule.input;

            if (input.touchSupported)
            {
                var touch = input.GetTouch(0);
                Touched?.Invoke(new Vector2(touch.position.x / Screen.width, touch.position.y / Screen.height));
            }
            else
            {
                Touched?.Invoke(new Vector2(input.mousePosition.x / Screen.width, input.mousePosition.y / Screen.height));
            }
        }
Пример #6
0
 public void RaiseTouched(bool down)
 {
     State = down ? CarButtonState.Down : CarButtonState.Up;
     Touched?.Invoke(this, EventArgs.Empty);
 }
 public virtual void OnTouch(SKPoint point)
 {
     Touched?.Invoke(point);
 }
Пример #8
0
        // 启动后台任务。
        // 后台任务负责监视 指纹中心 里面新到的 message
        public static void Start(
            CancellationToken token)
        {
            // App.CurrentApp.Speak("启动后台线程");
            Base.Start((channel) =>
            {
                var result = channel.Object.GetState("");
                if (result.Value == -1)
                {
                    throw new Exception($"指纹中心当前处于 {result.ErrorCode} 状态({result.ErrorInfo})");
                }
                channel.Started = true;

                channel.Object.EnableSendKey(false);
            },
                       null,
                       (channel) =>
            {
                var result = channel.Object.GetMessage("");
                if (result.Value == -1)
                {
                    Base.TriggerSetError(result,
                                         new SetErrorEventArgs {
                        Error = result.ErrorInfo
                    });
                }
                else
                {
                    Base.TriggerSetError(result,
                                         new SetErrorEventArgs {
                        Error = null
                    });                                          // 清除以前的报错
                }
                if (result.Value != -1 && result.Message == null)
                {
                    // 状态转向 ok,需要补充触发一次
                    if (_state != "ok")
                    {
                        Touched?.Invoke(result, new TouchedEventArgs
                        {
                            Message    = result.Message,
                            Quality    = result.Quality,
                            ErrorOccur = result.Value == -1,
                            Result     = result
                        });
                    }

                    // 没有消息的时候不用惊扰事件订阅者
                    _state = "ok";
                }
                else
                {
                    if (result.Value == -1)
                    {
                        _state = "error";
                    }
                    else
                    {
                        _state = "ok";
                    }

                    // 注: result.Value == -1 的时候,SetError 也触发了,Touched 也触发了。
                    // 如果应用已经挂接了 SetError 事件,建议 Touched 里面可以忽略 result.Value == -1 的情况
                    Touched?.Invoke(result, new TouchedEventArgs
                    {
                        Message    = result.Message,
                        Quality    = result.Quality,
                        ErrorOccur = result.Value == -1,
                        Result     = result
                    });
                }
            },
                       token);
        }
Пример #9
0
 private void TouchEffect_OnCompleted(object sender, TouchCompletedEventArgs e)
 {
     Touched?.Invoke(this, e);
     TouchedCommand?.Execute(this);
 }
Пример #10
0
 protected void EmitTouched()
 {
     Touched?.Invoke(this, EventArgs.Empty);
 }
Пример #11
0
 public void SendTouched()
 {
     Touched?.Invoke(this, EventArgs.Empty);
 }