Exemplo n.º 1
0
        /// <summary>
        ///  Prompt user to select a Point on screen.
        /// </summary>
        /// <param name="parentForm">
        ///  A new window will open for this parent form.
        /// </param>
        /// <returns>
        ///  Point that was selected by user. Null if selection was cancelled.
        /// </returns>
        public static Point?SelectPoint(Form parentForm)
        {
            var desktopOverlayForm = new DesktopOverlayForm();

            desktopOverlayForm.ShowDialog(parentForm);
            return(desktopOverlayForm.MouseClickPoint);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Try making window top most, based on mouse click location.
        /// </summary>
        private void PinWindowPrompt()
        {
            if (this._isDesktopOverlayShown)
            {
                //prevent overlay from pinning itself
                return;
            }

            this._isDesktopOverlayShown = true;
            try
            {
                Point?mouseClickPoint = DesktopOverlayForm.SelectPoint(ParentForm);
                if (mouseClickPoint == null)
                {
                    //no point was selected by user, do nothing
                    return;
                }

                this.pinnedWindowListControl.TryAddWindowFromPoint(mouseClickPoint.Value);
            }
            finally
            {
                this._isDesktopOverlayShown = false;
            }
        }