예제 #1
0
        public HtmlList GetHtmlList(string searchParameters)
        {
            var lst = new HtmlList(searchParameters);

            lst.Wrap(new CUITControls.HtmlList(this));
            return(lst);
        }
예제 #2
0
        private static ControlBase WrapUtil(CUITControls.HtmlControl sourceControl)
        {
            ControlBase control;

            if (sourceControl.GetType() == typeof(CUITControls.HtmlButton))
            {
                control = new HtmlButton((CUITControls.HtmlButton)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlCheckBox))
            {
                control = new HtmlCheckBox((CUITControls.HtmlCheckBox)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlComboBox))
            {
                control = new HtmlComboBox((CUITControls.HtmlComboBox)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlDiv))
            {
                control = new HtmlDiv((CUITControls.HtmlDiv)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlEdit) && (string.Compare(sourceControl.Type, "password", true) == 0))
            {
                control = new HtmlPassword((CUITControls.HtmlEdit)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlEdit))
            {
                control = new HtmlEdit((CUITControls.HtmlEdit)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlEditableDiv))
            {
                control = new HtmlEditableDiv((CUITControls.HtmlEditableDiv)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlFileInput))
            {
                control = new HtmlFileInput((CUITControls.HtmlFileInput)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlHyperlink))
            {
                control = new HtmlHyperlink((CUITControls.HtmlHyperlink)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlImage))
            {
                control = new HtmlImage((CUITControls.HtmlImage)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlInputButton))
            {
                control = new HtmlInputButton((CUITControls.HtmlInputButton)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlLabel))
            {
                control = new HtmlLabel((CUITControls.HtmlLabel)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlList))
            {
                control = new HtmlList((CUITControls.HtmlList)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlRadioButton))
            {
                control = new HtmlRadioButton((CUITControls.HtmlRadioButton)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlSpan))
            {
                control = new HtmlSpan((CUITControls.HtmlSpan)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlEditableSpan))
            {
                control = new HtmlEditableSpan((CUITControls.HtmlEditableSpan)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlTable))
            {
                control = new HtmlTable((CUITControls.HtmlTable)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlCell))
            {
                control = new HtmlCell((CUITControls.HtmlCell)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlTextArea))
            {
                control = new HtmlTextArea((CUITControls.HtmlTextArea)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlIFrame))
            {
                control = new HtmlIFrame((CUITControls.HtmlIFrame)sourceControl);
            }
            else if (sourceControl.GetType() == typeof(CUITControls.HtmlCustom))
            {
                switch (sourceControl.TagName.ToLower())
                {
                case "p":
                    control = new HtmlParagraph((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "h1":
                    control = new HtmlHeading1((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "h2":
                    control = new HtmlHeading2((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "h3":
                    control = new HtmlHeading3((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "h4":
                    control = new HtmlHeading4((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "h5":
                    control = new HtmlHeading5((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "h6":
                    control = new HtmlHeading6((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "ul":
                    control = new HtmlUnorderedList((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "ol":
                    control = new HtmlOrderedList((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "li":
                    control = new HtmlListItem((CUITControls.HtmlCustom)sourceControl);
                    break;

                case "ins":
                    control = new HtmlIns((CUITControls.HtmlCustom)sourceControl);
                    break;

                default:
                    control = new HtmlCustom((CUITControls.HtmlCustom)sourceControl, By.TagName(sourceControl.TagName));
                    break;
                }
            }
            else
            {
                throw new Exception(string.Format("WrapUtil: '{0}' not supported", sourceControl.GetType().Name));
            }

            return(control);
        }