예제 #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);
        }
예제 #2
0
파일: Win32Api.cs 프로젝트: hegaojie/FinnTP
 public static extern bool GetCursorPos(ref Point lpPoint);
예제 #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;
            }
        }