Exemple #1
0
        private void OnLeftButtonDown(object sender,
                                      System.Windows.Forms.HtmlElementEventArgs arg)
        {
            System.Windows.Forms.HtmlDocument doc     = (System.Windows.Forms.HtmlDocument)sender;
            System.Windows.Forms.HtmlElement  element = doc.GetElementFromPoint(arg.MousePosition);

            HtmlScreenElementBase newFcsElement = FindFocusElement(element);

            if (null != newFcsElement)
            {
                if (m_focusElement != newFcsElement)
                {
                    m_focusElement = newFcsElement;
                    //  ShowHandleInput(true);
                }
                m_focusElement.SetFocus();
            }
            else
            {
                ShowScreenKeyboard(false);
                m_focusElement = null;
                // ShowHandleInput(false);
            }

            HtmlScreenElementBase button = FindButtonInHtml(element);

            if (null == button)
            {
                System.Windows.Forms.HtmlElement parentElement = element.Parent;
                if (null == parentElement)
                {
                    return;
                }

                button = FindButtonInHtml(parentElement);
                if (null == button)
                {
                    return;
                }
            }

            button.OnLeftMouseDown(sender, arg);
            arg.ReturnValue = true;
        }
Exemple #2
0
        public object ExecuteCustomCommand(string argName,
                                           params object[] args)
        {
            Debug.Assert(!string.IsNullOrEmpty(argName));
            Log.UIService.LogDebugFormat("execute command[{0}] in html screen", argName);
            switch (argName)
            {
            case UIServiceCommands.s_clearDataBind:
            {
                Log.UIService.LogDebug("Remove property changed event");
                RemovePropertyChangedEvent();

                ShowScreenKeyboard(false);
            }
            break;

            case UIServiceCommands.s_updateData:
            {
                Log.UIService.LogDebug("Prepare for update data");

                foreach (var item in m_dicScreenElements)
                {
                    if ((item.Value is HtmlScreenInputElement) ||
                        (item.Value is HtmlScreenSelectElement))
                    {
                        item.Value.UpdateBindingData(true);
                    }
                }
            }
            break;

            case UIServiceCommands.s_buttonDown:
            {
                if (null == args[0] ||
                    !(args[0] is string))
                {
                    return(null);
                }

                Log.UIService.LogDebugFormat("The button [{0}] is down", args[0]);
                string name = (string)args[0];
                HtmlScreenElementBase element = null;
                if (m_dicScreenElements.TryGetValue(name, out element))
                {
                    element.OnLeftMouseDown(null, null);
                }
                //foreach (var item in m_dicScreenElements)
                //{
                //    if ( (item.Value is HtmlScreenButtonElement) &&
                //         (name.Equals( item.Value.HostedElement.Id, StringComparison.OrdinalIgnoreCase )) )
                //    {
                //        item.Value.OnLeftMouseDown( null, null );
                //        break;
                //    }
                //}
            }
            break;

            case UIServiceCommands.s_buttonUp:
            {
                if (null == args[0])
                {
                    return(null);
                }

                Log.UIService.LogDebugFormat("The button [{0}] is up", args[0]);
                string name = (string)args[0];
                HtmlScreenElementBase element = null;
                if (m_dicScreenElements.TryGetValue(name, out element))
                {
                    element.OnLeftMouseUp(null, null);
                }
                //foreach (var item in m_dicScreenElements)
                //{
                //    if ((item.Value is HtmlScreenButtonElement) &&
                //         (name.Equals(item.Value.HostedElement.Id, StringComparison.OrdinalIgnoreCase)))
                //    {
                //        item.Value.OnLeftMouseUp(null, null);
                //        break;
                //    }
                //}
            }
            break;

            default:
            {
                Log.UIService.LogDebug("The unsupported custom command");
                Debug.Assert(false);
            }
            break;
            }
            return(null);
        }