private void OnLeftMouseButtonPressed(MouseEventArgs e) { LeftMouseButtonPressed?.Invoke(this, e); }
private void OnMouseHookCalled(MouseEventArgs e) { // dispatch corresponding event based on windows mouse message switch (e.MouseMessage) { case MouseMessage.LeftButtonDown: LeftMouseButtonPressed?.Invoke(this, e); break; case MouseMessage.LeftButtonUp: LeftMouseButtonReleased?.Invoke(this, e); break; case MouseMessage.RightButtonDown: RightMouseButtonPressed?.Invoke(this, e); break; case MouseMessage.RightButtonUp: RightMouseButtonReleased?.Invoke(this, e); break; case MouseMessage.MiddleButtonDown: MiddleMouseButtonPressed?.Invoke(this, e); break; case MouseMessage.MiddleButtonUp: MiddleMouseButtonReleased?.Invoke(this, e); break; case MouseMessage.VerticalMouseWheel: if (e.MouseTransitionState == MouseTransitionState.MouseWheelUp) { VerticalMouseWheelUpScrolled?.Invoke(this, e); } else { VerticalMouseWheelDownScrolled?.Invoke(this, e); } break; case MouseMessage.HorizontalMouseWheel: if (e.MouseTransitionState == MouseTransitionState.MouseWheelRight) { HorizontalMouseWheelRightScrolled?.Invoke(this, e); } else { HorizontalMouseWheelLeftScrolled?.Invoke(this, e); } break; default: MouseMoved?.Invoke(this, e); break; } }