Exemple #1
0
        public EnhancedHtmlCheckBox GetEmbeddedCheckBox(int iRow, int iCol)
        {
            string sSearchProperties = "";

            mshtml.IHTMLElement td    = (mshtml.IHTMLElement)GetCell(iRow, iCol).UnWrap().NativeElement;
            mshtml.IHTMLElement check = GetEmbeddedCheckBoxNativeElement(td);
            string sOuterHTML         = check.outerHTML.Replace("<", "").Replace(">", "").Trim();

            string[]     saTemp = sOuterHTML.Split(' ');
            HtmlCheckBox chk    = new HtmlCheckBox(this.Control.Container);

            foreach (string sTemp in saTemp)
            {
                if (sTemp.IndexOf('=') > 0)
                {
                    string[] saKeyValue = sTemp.Split('=');
                    string   sValue     = saKeyValue[1];
                    if (saKeyValue[0].ToLower() == "name")
                    {
                        sSearchProperties += ";Name=" + sValue;
                        chk.SearchProperties.Add(HtmlControl.PropertyNames.Name, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "id")
                    {
                        sSearchProperties += ";Id=" + sValue;
                        chk.SearchProperties.Add(HtmlControl.PropertyNames.Id, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "class")
                    {
                        sSearchProperties += ";Class=" + sValue;
                        chk.SearchProperties.Add(HtmlControl.PropertyNames.Class, sValue);
                    }
                }
            }

            if (sSearchProperties.Length > 1)
            {
                sSearchProperties = sSearchProperties.Substring(1);
            }
            EnhancedHtmlCheckBox retChk = new EnhancedHtmlCheckBox(sSearchProperties);

            retChk.Wrap(chk);
            return(retChk);
        }
        private static IEnhancedHtmlControl WrapUtil(HtmlControl control)
        {
            IEnhancedHtmlControl con = null;

            if (control.GetType() == typeof(HtmlButton))
            {
                con = new EnhancedHtmlButton();
            }
            else if (control.GetType() == typeof(HtmlCheckBox))
            {
                con = new EnhancedHtmlCheckBox();
            }
            else if (control.GetType() == typeof(HtmlComboBox))
            {
                con = new EnhancedHtmlComboBox();
            }
            else if (control.GetType() == typeof(HtmlDiv))
            {
                con = new EnhancedHtmlDiv();
            }
            else if (control.GetType() == typeof(HtmlEdit) && (string.Compare(control.Type, "password", true) == 0))
            {
                con = new EnhancedHtmlPassword();
            }
            else if (control.GetType() == typeof(HtmlEdit))
            {
                con = new EnhancedHtmlEdit();
            }
            else if (control.GetType() == typeof(HtmlEditableDiv))
            {
                con = new EnhancedHtmlEditableDiv();
            }
            else if (control.GetType() == typeof(HtmlFileInput))
            {
                con = new EnhancedHtmlFileInput();
            }
            else if (control.GetType() == typeof(HtmlHyperlink))
            {
                con = new EnhancedHtmlHyperlink();
            }
            else if (control.GetType() == typeof(HtmlImage))
            {
                con = new EnhancedHtmlImage();
            }
            else if (control.GetType() == typeof(HtmlInputButton))
            {
                con = new EnhancedHtmlInputButton();
            }
            else if (control.GetType() == typeof(HtmlLabel))
            {
                con = new EnhancedHtmlLabel();
            }
            else if (control.GetType() == typeof(HtmlList))
            {
                con = new EnhancedHtmlList();
            }
            else if (control.GetType() == typeof(HtmlListItem))
            {
                con = new EnhancedHtmlListItem();
            }
            else if (control.GetType() == typeof(HtmlRadioButton))
            {
                con = new EnhancedHtmlRadioButton();
            }
            else if (control.GetType() == typeof(HtmlSpan))
            {
                con = new EnhancedHtmlSpan();
            }
            else if (control.GetType() == typeof(HtmlEditableSpan))
            {
                con = new EnhancedHtmlEditableSpan();
            }
            else if (control.GetType() == typeof(HtmlTable))
            {
                con = new EnhancedHtmlTable();
            }
            else if (control.GetType() == typeof(HtmlCell))
            {
                con = new EnhancedHtmlCell();
            }
            else if (control.GetType() == typeof(HtmlTextArea))
            {
                con = new EnhancedHtmlTextArea();
            }
            else if (control.GetType() == typeof(HtmlScrollBar))
            {
                con = new EnhancedHtmlScrollBar();
            }
            else if (control.GetType() == typeof(HtmlTextArea))
            {
                con = new EnhancedHtmlTextArea();
            }
            else if (control.GetType() == typeof(HtmlCustom))
            {
                switch (control.TagName.ToLower())
                {
                case "p":
                    con = new EnhancedHtmlParagraph();
                    break;

                case "h1":
                    con = new EnhancedHtmlHeading1();
                    break;

                case "h2":
                    con = new EnhancedHtmlHeading2();
                    break;

                case "h3":
                    con = new EnhancedHtmlHeading3();
                    break;

                case "h4":
                    con = new EnhancedHtmlHeading4();
                    break;

                case "h5":
                    con = new EnhancedHtmlHeading5();
                    break;

                case "h6":
                    con = new EnhancedHtmlHeading6();
                    break;

                case "ul":
                    con = new EnhancedHtmlUnorderedList();
                    break;

                case "ol":
                    con = new EnhancedHtmlOrderedList();
                    break;

                case "ins":
                    con = new EnhancedHtmlIns();
                    break;

                default:
                    con = new EnhancedHtmlCustom(control.TagName);
                    break;
                }
            }
            else
            {
                throw new Exception(string.Format("WrapUtil: '{0}' not supported", control.GetType().Name));
            }
            con.WrapReady(control);
            return(con);
        }