Esempio n. 1
0
        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                switch ((MouseMessage)wParam)
                {
                case MouseMessage.WM_LBUTTONDOWN:
                    OnLeftButtonDown?.Invoke(null, new MouseEventsArgs
                    {
                        Button = MouseButtons.Left,
                        State  = MouseState.MouseDown
                    });
                    break;

                case MouseMessage.WM_LBUTTONUP:
                    OnLeftButtonUp?.Invoke(null, new MouseEventsArgs
                    {
                        Button = MouseButtons.Left,
                        State  = MouseState.MouseUp
                    });
                    break;

                case MouseMessage.WM_LBUTTONDBLCLK:
                    OnLeftDoubleClick?.Invoke(null, new MouseEventsArgs
                    {
                        Button      = MouseButtons.Left,
                        State       = MouseState.MouseUp,
                        DoubleClick = true
                    });
                    break;

                case MouseMessage.WM_RBUTTONDOWN:
                    OnRightButtonDown?.Invoke(null, new MouseEventsArgs
                    {
                        Button = MouseButtons.Right,
                        State  = MouseState.MouseUp
                    });
                    break;

                case MouseMessage.WM_RBUTTONUP:
                    OnRightButtonUp?.Invoke(null, new MouseEventsArgs
                    {
                        Button = MouseButtons.Right,
                        State  = MouseState.MouseUp
                    });
                    break;

                case MouseMessage.WM_MOUSEMOVE:
                    OnMouseMove?.Invoke(null, new MouseEventsArgs
                    {
                        Button = MouseButtons.None,
                        State  = MouseState.MouseMove
                    });
                    break;
                }
            }
            return(NativeMethods.CallNextHookEx(HookId, nCode, wParam, lParam));
        }
Esempio n. 2
0
        public override void ParseData(string command)
        {
            var jObject = JObject.Parse(command);

            if (jObject[LeftChannel] != null)
            {
                StatusLeft = jObject[LeftChannel].Value <string>();
                if (StatusLeft == "click")
                {
                    OnLeftClick?.Invoke(this, new WallSwitchEventArgs(StatusLeft));
                }
                else if (StatusLeft == "double_click")
                {
                    OnLeftDoubleClick?.Invoke(this, new WallSwitchEventArgs(StatusLeft));
                }
                else if (StatusLeft == "long_click")
                {
                    OnLeftLongClick?.Invoke(this, new WallSwitchEventArgs(StatusLeft));
                }
            }

            if (jObject[RightChannel] != null)
            {
                StatusRight = jObject[RightChannel].Value <string>();
                if (StatusRight == "click")
                {
                    OnRightClick?.Invoke(this, new WallSwitchEventArgs(StatusRight));
                }
                else if (StatusRight == "double_click")
                {
                    OnRightDoubleClick?.Invoke(this, new WallSwitchEventArgs(StatusRight));
                }
                else if (StatusRight == "long_click")
                {
                    OnRightLongClick?.Invoke(this, new WallSwitchEventArgs(StatusRight));
                }
            }
        }
Esempio n. 3
0
        public override void ParseData(string command)
        {
            var jObject = JObject.Parse(command);

            if (jObject[LeftChannel] != null)
            {
                if (jObject[LeftChannel].Value <string>() == "click")
                {
                    OnLeftClick?.Invoke(new EventArgs());
                }
                else if (jObject[LeftChannel].Value <string>() == "double_click")
                {
                    OnLeftDoubleClick?.Invoke(new EventArgs());
                }
                else if (jObject[LeftChannel].Value <string>() == "long_click")
                {
                    OnLeftLongClick?.Invoke(new EventArgs());
                }
            }

            if (jObject[RightChannel] != null)
            {
                if (jObject[RightChannel].Value <string>() == "click")
                {
                    OnRightClick?.Invoke(new EventArgs());
                }
                else if (jObject[RightChannel].Value <string>() == "double_click")
                {
                    OnRightDoubleClick?.Invoke(new EventArgs());
                }
                else if (jObject[RightChannel].Value <string>() == "long_click")
                {
                    OnRightLongClick?.Invoke(new EventArgs());
                }
            }
        }
Esempio n. 4
0
 public virtual void LeftDoubleClick(UIMouseEvent evt)
 {
     OnLeftDoubleClick?.Invoke(evt, this);
     Parent?.LeftDown(evt);
 }
Esempio n. 5
0
 public virtual void LeftDoubleClick(UIMouseEventArgs e)
 {
     OnLeftDoubleClick?.Invoke(this, e);
     Parent?.LeftDoubleClick(e);
 }