Exemplo n.º 1
0
        public override bool HandleWidgetTouched(INavigator navigator, MPoint position)
        {
            var args = new HyperlinkWidgetArguments();

            Touched?.Invoke(this, args);

            return(args.Handled);
        }
Exemplo n.º 2
0
 private void Pin_ValueChanged(object sender, GpioPinValueChangedEventArgs e)
 {
     if (e.Edge == GpioPinEdge.RisingEdge)
     {
         Touched?.Invoke();
     }
     else
     {
         Untouched?.Invoke();
     }
 }
Exemplo n.º 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));
            }
        }
Exemplo n.º 4
0
    protected override void Start()
    {
        base.Start();
        Touched touch = GetComponent <Touched>();

        if (side == Side.ALLY && touch != null)
        {
            touch.active = true;
        }

        if (side != Side.NEUTRAL)
        {
            ChangeColor(GameManager.instance.neutralColor);
        }
    }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
        public void Touch(string apartment)
        {
            var exceptions = new List <Exception>();

            foreach (var method in Touched?.GetInvocationList())
            {
                try
                {
                    method.DynamicInvoke(this, new BellTouchedEventArgs(apartment));
                }
                catch (Exception ex)
                {
                    exceptions.Add(ex);
                }
            }

            throw new AggregateException(exceptions);
        }
Exemplo n.º 7
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));
            }
        }
Exemplo n.º 8
0
 public void RaiseTouched(bool down)
 {
     State = down ? CarButtonState.Down : CarButtonState.Up;
     Touched?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 9
0
        protected bool GoodDirectory(string dir)
        {
            try
            {
                if (CheckDirectoryExists)
                {
                    if (!_LastTouched.ContainsKey(dir))
                    {
                        _LastTouched[dir] = new Touched {
                            Exists = false, LastAttempt = DateTime.MinValue
                        }
                    }
                    ;

                    if ((DateTime.UtcNow - _LastTouched[dir].LastAttempt).TotalSeconds > 180 || _LastTouched[dir].Exists)
                    {
                        if (!_LastTouched[dir].Exists)
                        {
                            if (DestinationPingable && !STEM.Sys.IO.Net.PingHost(STEM.Sys.IO.Path.IPFromPath(dir)))
                            {
                                _LastTouched[dir].LastAttempt = DateTime.UtcNow;
                                return(false);
                            }
                        }

                        if (!String.IsNullOrEmpty(DestinationPathUser) && !String.IsNullOrEmpty(DestinationPathPassword))
                        {
                            if (DirectoryExists(dir, DestinationPathUser, DestinationPathPassword, DestinationPathImpersonationIsLocal))
                            {
                                _LastTouched[dir].Exists = true;
                            }
                            else
                            {
                                _LastTouched[dir].Exists = false;
                            }
                        }
                        else
                        {
                            if (DirectoryExists(dir))
                            {
                                _LastTouched[dir].Exists = true;
                            }
                            else
                            {
                                _LastTouched[dir].Exists = false;
                            }
                        }

                        _LastTouched[dir].LastAttempt = DateTime.UtcNow;
                    }

                    return(_LastTouched[dir].Exists);
                }
                else
                {
                    return(true);
                }
            }
            catch { }

            return(false);
        }
 public virtual void OnTouch(SKPoint point)
 {
     Touched?.Invoke(point);
 }
Exemplo n.º 11
0
 public virtual void SetDownTouch(Touched downTouch)
 {
     this._downTouch = downTouch;
 }
Exemplo n.º 12
0
 private void TouchEffect_OnCompleted(object sender, TouchCompletedEventArgs e)
 {
     Touched?.Invoke(this, e);
     TouchedCommand?.Execute(this);
 }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
 protected void EmitTouched()
 {
     Touched?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 15
0
 public virtual void SetUpTouch(Touched upTouch)
 {
     this._upTouch = upTouch;
 }
Exemplo n.º 16
0
 public virtual void SetDragTouch(Touched dragTouch)
 {
     this._dragTouch = dragTouch;
 }
Exemplo n.º 17
0
 public virtual void SetAllTouch(Touched allTouch)
 {
     this._allTouch = allTouch;
 }
Exemplo n.º 18
0
 public void SendTouched()
 {
     Touched?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 19
0
    protected override void Die()
    {
        //for (int i = 1; i < transform.childCount; i++)
        //Destroy(transform.GetChild(i).gameObject);


        for (int i = 0; i < turrets.Count; i++)
        {
            if (turrets[i].childCount > 0)
            {
                for (int j = 0; j < turrets[i].childCount; j++)
                {
                    Destroy(turrets[i].GetChild(j).gameObject);
                    if (side == Side.ENEMY)
                    {
                        GameManager.instance.iA.turretCount--;
                    }
                }
            }
        }

        if (pumps.Count > 0)
        {
            for (int i = 0; i < pumps.Count; i++)
            {
                pumps[i].gameObject.SetActive(false);
                pumps[i].GetComponent <Pump>().enabled = true;
                if (side == Side.ENEMY)
                {
                    GameManager.instance.iA.pumpCount--;
                }
            }
        }

        side = lastDamageSide;
        Touched touch = GetComponent <Touched>();

        Color coloration = coloration = GameManager.instance.neutralColor;

        switch (side)
        {
        case Side.ALLY:
            if (touch != null)
            {
                touch.active = true;
            }
            coloration = GameManager.instance.allyColor;
            GameManager.instance.allies.Add(gameObject);
            break;

        case Side.ENEMY:
            if (touch != null)
            {
                touch.active = false;
            }
            coloration = GameManager.instance.enemyColor;
            break;

        case Side.NEUTRAL:
            if (touch != null)
            {
                touch.active = false;
            }
            coloration = GameManager.instance.neutralColor;
            break;
        }

        ChangeColor(coloration);

        curHealth = maxHealth;

        if (action != null)
        {
            action.Invoke();
        }

        UpdateHealth();
    }
Exemplo n.º 20
0
 public TouchedListener(Touched touched)
 {
     _touched = touched;
 }