Beispiel #1
0
        public async Task <int> TranslateAcceleratorAsync(MSG msg)
        {
            var message = new Message
            {
                hwnd    = msg.hwnd,
                message = (int)msg.message,
                wParam  = msg.wParam,
                lParam  = msg.lParam,
                time    = (int)msg.time,
                pt_x    = msg.pt.x,
                pt_y    = msg.pt.y
            };

            var used = ComponentDispatcher.RaiseThreadMessage(ref message);

            if (used)
            {
                msg.message = (uint)message.message;
                msg.wParam  = message.wParam;
                msg.lParam  = message.lParam;

                return(VSConstants.S_OK);
            }

            if (_propertyPageSite != null)
            {
                await _projectThreadingService.SwitchToUIThread();

                return(_propertyPageSite.TranslateAccelerator(new MSG[] { msg }));
            }

            return(VSConstants.S_OK);
        }
Beispiel #2
0
 public int TranslateAccelerator(MSG[] pMsg)
 {
     if (site != null)
     {
         return(site.TranslateAccelerator(pMsg));
     }
     else
     {
         return(0);
     }
 }
Beispiel #3
0
        public int TranslateAccelerator(MSG[] pMsg)
        {
            if (pMsg == null)
            {
                return(VSConstants.E_POINTER);
            }
#if DEBUG
            if (pMsg.Length == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(pMsg));
            }
#endif
            if (_propertyPageUI.TranslateAccelerator(ref pMsg[0]))
            {
                return(VSConstants.S_OK);
            }

            _projectThreadingService.VerifyOnUIThread();
            return(_propertyPageSite?.TranslateAccelerator(pMsg) ?? VSConstants.S_FALSE);
        }
Beispiel #4
0
        public int TranslateAccelerator(VsMsg[] pMsg)
        {
            if (pMsg == null || pMsg.Length == 0)
            {
                throw new ArgumentNullException(nameof(pMsg));
            }

            var xMsg     = pMsg[0];
            var xMessage = new Message();

            xMessage.hwnd    = xMsg.hwnd;
            xMessage.message = (int)xMsg.message;
            xMessage.wParam  = xMsg.wParam;
            xMessage.lParam  = xMsg.lParam;
            xMessage.time    = (int)xMsg.time;
            xMessage.pt_x    = xMsg.pt.x;
            xMessage.pt_y    = xMsg.pt.y;

            var xUsed = ComponentDispatcher.RaiseThreadMessage(ref xMessage);

            if (xUsed)
            {
                xMsg.message = (uint)xMessage.message;
                xMsg.wParam  = xMessage.wParam;
                xMsg.lParam  = xMessage.lParam;

                return(VSConstants.S_OK);
            }

            int xResult = 0;

            if (mPropertyPageSite != null)
            {
                ProjectThreadingService.SwitchToUIThread();
                xResult = mPropertyPageSite.TranslateAccelerator(pMsg);
            }

            return(xResult);
        }
Beispiel #5
0
        ///--------------------------------------------------------------------------------------------
        /// <summary>
        /// IPropertyPage
        /// Handles mneumonics
        /// </summary>
        ///--------------------------------------------------------------------------------------------
        public int TranslateAccelerator(MSG[] pMsg)
        {
            if (pMsg == null)
            {
                return(VSConstants.E_POINTER);
            }

            System.Windows.Forms.Message m = System.Windows.Forms.Message.Create(pMsg[0].hwnd, (int)pMsg[0].message, pMsg[0].wParam, pMsg[0].lParam);
            bool used = false;

            // Preprocessing should be passed to the control whose handle the message refers to.
            Control target = Control.FromChildHandle(m.HWnd);

            if (target != null)
            {
                used = target.PreProcessMessage(ref m);
            }

            if (used)
            {
                pMsg[0].message = (uint)m.Msg;
                pMsg[0].wParam  = m.WParam;
                pMsg[0].lParam  = m.LParam;
                // Returning S_OK indicates we handled the message ourselves
                return(VSConstants.S_OK);
            }


            // Returning S_FALSE indicates we have not handled the message
            int result = 0;

            if (_site != null)
            {
                result = _site.TranslateAccelerator(pMsg);
            }
            return(result);
        }
Beispiel #6
0
 public int TranslateAccelerator(MSG[] msg)
 {
     return(_pageSite.TranslateAccelerator(msg));
 }