Exemple #1
0
    public SimpleMouseGesture(NativeMouseEvents eventType, int x, int y, MouseButtonState left, MouseButtonState right, MouseButtonState middle, MouseButtonState firstExtra, MouseButtonState secondExtra, short mouseDelta = 0)
    {
        EventType = eventType;

        PosX = x;
        PosY = y;

        LeftButton        = left;
        RightButton       = right;
        MiddleButton      = middle;
        FirstExtraButton  = firstExtra;
        SecondExtraButton = secondExtra;
        MouseDelta        = mouseDelta;
    }
Exemple #2
0
        private void DetectDoubleClick(NativeMouseEvents type, PointW point)
        {
            var deltaMs = DateTime.Now - _lastClickTime;

            _lastClickTime = DateTime.Now;

            if (deltaMs.TotalMilliseconds <= User32.GetDoubleClickTime())
            {
                _clickCount++;
            }
            else
            {
                _clickCount = 1;
            }

            if (_clickCount != 2)
            {
                return;
            }

            OnMouseActivity?.Invoke(this, new SimpleMouseGesture(type, point.X, point.Y, _leftButton, _rightButton, _middleButton, _extraButton, _extra2Button));
            _clickCount = 0;
        }