Exemple #1
0
        public SUIHtmlImage SearchHtmlImageByNameProp(string text, int index)
        {
            List <SUIHtmlControlBase> list = GetElementsByTagName("IMG");
            int i = 0;

            foreach (SUIHtmlControlBase ctrl in list)
            {
                if (SUIHtmlImage.IsImageElement(ctrl))
                {
                    SUIHtmlImage img = new SUIHtmlImage(ctrl);

                    string name = img.IHTMLImgElement.nameProp.ToLower();
                    if (name != null)
                    {
                        name = name.Replace("_over", "");
                        //Handle changeable temp file name.
                        //e.g. crystalimagehandler.aspx?dynamicimage=cr_tmp_image_8f388c98-6123-42e4-a244-00ac4e52d6b3.png
                        int indexStart = name.IndexOf("_tmp_image_");
                        if (indexStart > -1)
                        {
                            string strChange = name.Substring(indexStart + 11, name.Length - 4 - (indexStart + 11));
                            name = name.Replace(strChange, "*");
                        }
                    }

                    if ((name != null && name.Equals(text)) ||
                        (name == null && text == null))
                    {
                        if (i == index)
                        {
                            return(img);
                        }
                        i++;
                    }
                }
            }
            return(null);
        }
Exemple #2
0
        public SUIHtmlImage SearchHtmlImageByNameProp(string text, int index)
        {
            List<SUIHtmlControlBase> list = GetElementsByTagName("IMG");
            int i = 0;
            foreach (SUIHtmlControlBase ctrl in list)
            {
                if (SUIHtmlImage.IsImageElement(ctrl))
                {
                    SUIHtmlImage img = new SUIHtmlImage(ctrl);

                    string name = img.IHTMLImgElement.nameProp.ToLower();
                    if (name != null)
                    {
                        name = name.Replace("_over", "");
                        //Handle changeable temp file name.
                        //e.g. crystalimagehandler.aspx?dynamicimage=cr_tmp_image_8f388c98-6123-42e4-a244-00ac4e52d6b3.png
                        int indexStart = name.IndexOf("_tmp_image_");
                        if (indexStart > -1)
                        {
                            string strChange = name.Substring(indexStart + 11, name.Length - 4 - (indexStart + 11));
                            name = name.Replace(strChange, "*");
                        }
                    }

                    if ((name != null && name.Equals(text)) ||
                        (name == null && text == null))
                    {
                        if (i == index)
                        {
                            return img;
                        }
                        i++;
                    }
                }
            }
            return null;
        }