Esempio n. 1
0
        public bool OnKeyEvent(IWebBrowser chromiumWebBrowser, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey)
        {
            if (_onAfterButtonEvent_script == null)
            {
                return(false);
            }

            var ki = new KeyboardEventInfo(type, windowsKeyCode, nativeKeyCode, modifiers, isSystemKey);

            JSEngine.Instance.SetValue("keyEvent", ki.ToJson());
            JSEngine.Instance.Execute(_onAfterButtonEvent_script, "on-after-key");

            return(false);
        }
Esempio n. 2
0
        public bool OnPreKeyEvent(IWebBrowser chromiumWebBrowser, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut)
        {
            if (_onPreButtonEvent_script == null)
            {
                return(false);
            }

            var ki = new KeyboardEventInfo(type, windowsKeyCode, nativeKeyCode, modifiers, isSystemKey);

            JSEngine.Instance.SetValue("keyEvent", ki.ToJson());
            string result = JSEngine.Instance.ExecuteResult(_onPreButtonEvent_script, "on-before-key");

            if (result == null)
            {
                return(false);
            }

            return(result.ToLower() == "true");
        }