Esempio n. 1
0
        public void ShowContextMenu(Point position)
        {
            ContextMenu.IsOpen = true;
            ContextMenu.Placement = PlacementMode.AbsolutePoint;

            ContextMenu.HorizontalOffset = position.X;
            ContextMenu.VerticalOffset = position.Y;

            Win32Api.SetForegroundWindow(_msgSink.MsgWinHandle);
        }
Esempio n. 2
0
 public static extern bool GetCursorPos(ref Point lpPoint);
Esempio n. 3
0
        private void MsgSinkOnMouseEventReceived(MouseEvent mouseEvent)
        {
            switch (mouseEvent)
            {
                case MouseEvent.RightMouseDown:
                    var position = new Point();

                    Win32Api.GetCursorPos(ref position);

                    _notifyIcon.ShowContextMenu(position);

                    break;

                case MouseEvent.LeftMouseDoubleClick:
                    if (_isActivated)
                        HideAndDeactivate();
                    else
                        ShowAndActivate();

                    break;

                case MouseEvent.LeftMouseDown:
                    break;

                case MouseEvent.LeftMouseUp:
                    break;
                default:
                    break;
            }
        }