Exemplo n.º 1
0
        /// <summary>
        /// DispatchEvent
        /// </summary>
        public void DispatchEvent(HtmlEvent htmlEvent)
        {
            // [01/26/2009] Missing support for CanBuble and Cancelable.
            //      They're never set as arguments for the events even though HtmlEvent exposes them.
            BrowserCommand command = new BrowserCommand();

            command.Handler.RequiresElementFound = true;

            HtmlKeyEvent keyEvent = htmlEvent as HtmlKeyEvent;

            if (keyEvent != null)
            {
                command.Handler.ClientFunctionName = BrowserCommand.FunctionNames.DispatchKeyEvent;
                command.Handler.SetArguments(keyEvent.Name,
                                             keyEvent.CtrlKey, keyEvent.AltKey, keyEvent.ShiftKey, keyEvent.MetaKey,
                                             keyEvent.KeyCode, keyEvent.CharCode);
            }
            else if (htmlEvent is HtmlMouseEvent)
            {
                command.Handler.ClientFunctionName = BrowserCommand.FunctionNames.DispatchMouseEvent;
                command.Handler.SetArguments(htmlEvent.Name);
            }
            else
            {
                command.Handler.ClientFunctionName = BrowserCommand.FunctionNames.DispatchHtmlEvent;
                command.Handler.SetArguments(htmlEvent.Name);
            }

            command.Target      = this.BuildBrowserCommandTarget();
            command.Description = "DispatchEvent:" + htmlEvent.Name;

            this.ParentPage.ExecuteCommand(command);
        }
Exemplo n.º 2
0
        /// <summary>
        /// DispatchEvent
        /// </summary>
        public void DispatchEvent(HtmlEventName eventName)
        {
            HtmlEvent evt = HtmlEvent.Create(eventName);

            DispatchEvent(evt);
        }