Ejemplo n.º 1
0
        public void loadInfo(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            if (e == null)
            {
                return;
            }


            e = getContent(e);
            if (e == null)
            {
                return;
            }

            IfacesEnumsStructsClasses.IHTMLElement2          n = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            IfacesEnumsStructsClasses.IHTMLElementCollection c = n.getElementsByTagName("TD") as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c != null)
            {
                if (c.length >= 2)
                {
                    int i = 0;
                    foreach (object obj in c)
                    {
                        IfacesEnumsStructsClasses.IHTMLElement r = (IfacesEnumsStructsClasses.IHTMLElement)obj;
                        if (i == 0)
                        {
                            title.Text = "题目:" + r.innerText;
                            i++;
                        }
                        else
                        {
                            description.Text = "描述:" + r.innerText;
                            break;
                        }
                    }



                    // title.Text = ((c.)) as IfacesEnumsStructsClasses.IHTMLElement).innerText;
                    // description.Text = ((c.item(1)) as IfacesEnumsStructsClasses.IHTMLElement).innerText;
                }
            }
            c = n.getElementsByTagName("INPUT") as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c != null)
            {
                foreach (object obj in c)
                {
                    IfacesEnumsStructsClasses.IHTMLElement input = (IfacesEnumsStructsClasses.IHTMLElement)obj;
                    if (input != null)
                    {
                        if (input.getAttribute("TYPE", 1).ToString().Equals("RADIO") || input.getAttribute("type", 1).ToString().Equals("radio"))
                        {
                            ListViewItem item = new ListViewItem(input.getAttribute("value", 1).ToString());
                            item.Tag = input.getAttribute("name", 1).ToString();
                            this.listView1.Items.Add(item);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void initListView()
        {
            listView1.View = View.Details;
            listView1.Columns.Add("对象", -2, HorizontalAlignment.Left);

            listView2.View = View.Details;
            listView2.Columns.Add("对象", -2, HorizontalAlignment.Left);
            if (pform == null)
            {
                return;
            }
            IfacesEnumsStructsClasses.IHTMLElement2          bd = pform.cEXWB1.GetActiveDocument().body as IfacesEnumsStructsClasses.IHTMLElement2;
            IfacesEnumsStructsClasses.IHTMLElementCollection c  = (bd.getElementsByTagName("input")) as IfacesEnumsStructsClasses.IHTMLElementCollection;

            foreach (IfacesEnumsStructsClasses.IHTMLElement te in c)
            {
                string type = te.getAttribute("type", 1).ToString();
                if (type == null || type.Equals(""))
                {
                    continue;
                }
                addObj(te);
            }

            c = (bd.getElementsByTagName("textarea")) as IfacesEnumsStructsClasses.IHTMLElementCollection;
            foreach (IfacesEnumsStructsClasses.IHTMLElement te in c)
            {
                addObj(te);
            }
            c = null;
        }
Ejemplo n.º 3
0
        public override void deletMeRelation(IfacesEnumsStructsClasses.IHTMLElement e, DemoApp.frmHTMLeditor pform)
        {
            IfacesEnumsStructsClasses.IHTMLElement2          e2 = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            IfacesEnumsStructsClasses.IHTMLElementCollection c  = (e2.getElementsByTagName("input")) as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c == null)
            {
                return;
            }
            e = null;
            foreach (IfacesEnumsStructsClasses.IHTMLElement ce in c)
            {
                e = ce;
                break;
            }
            if (e == null)
            {
                return;
            }

            if (e.getAttribute("id", 1) == null)
            {
                return;
            }
            string id = e.getAttribute("id", 1).ToString();

            int idx = id.LastIndexOf("_");

            id = id.Substring(0, idx);

            IfacesEnumsStructsClasses.IHTMLElement2 bd = pform.cEXWB1.GetActiveDocument().body as IfacesEnumsStructsClasses.IHTMLElement2;
            c = (bd.getElementsByTagName("input")) as IfacesEnumsStructsClasses.IHTMLElementCollection;
            foreach (IfacesEnumsStructsClasses.IHTMLElement ce in c)
            {
                object o = ce.getAttribute("type", 1);
                if (o == null)
                {
                    continue;
                }
                string type = o.ToString();
                if (!type.Equals("submit"))
                {
                    continue;
                }

                o = ce.getAttribute("listObj", 1);
                if (o == null)
                {
                    return;
                }
                string sp = o.ToString();
                sp = sp.Replace(id + ";", "");
                ce.setAttribute("listObj", sp, 1);
            }
        }
Ejemplo n.º 4
0
        public IfacesEnumsStructsClasses.IHTMLElement getContent(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            if (e == null)
            {
                return(null);
            }
            IfacesEnumsStructsClasses.IHTMLElement2          n = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            IfacesEnumsStructsClasses.IHTMLElementCollection c = n.getElementsByTagName("TABLE") as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c == null)
            {
                return(null);
            }

            foreach (object obj in c)
            {
                IfacesEnumsStructsClasses.IHTMLElement r = (IfacesEnumsStructsClasses.IHTMLElement)obj;
                return(r);
            }

            return(null);
        }
Ejemplo n.º 5
0
        public void loadElement(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            if (e == null)
            {
                return;
            }
            IfacesEnumsStructsClasses.IHTMLElement2          e2 = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            IfacesEnumsStructsClasses.IHTMLElementCollection c  = (e2.getElementsByTagName("input")) as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c == null)
            {
                return;
            }
            foreach (IfacesEnumsStructsClasses.IHTMLElement ce in c)
            {
                e = ce;
                break;
            }
            if (e.getAttribute("listObj", 1) == null)
            {
                c = null;
                return;
            }
            string        s  = e.getAttribute("listObj", 1).ToString();
            List <string> ss = utility.parseStrings(s, ";");

            listView2.Items.Clear();
            for (int i = 0; i < ss.Count; i++)
            {
                ListViewItem item2 = new ListViewItem(ss[i]);
                item2.Tag = ss[i];
                listView2.Items.Add(item2);
            }
            if (e.getAttribute("action", 1) == null)
            {
                return;
            }

            this.textBox1.Text = e.getAttribute("action", 1).ToString();
        }
Ejemplo n.º 6
0
        override public IfacesEnumsStructsClasses.IHTMLElement loadInfoFromElement(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            if (e == null)
            {
                return(null);
            }

            submitForm sform = new submitForm(this.pform);

            sform.loadElement(e);
            if (sform.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            string listObj = "";

            for (int i = 0; i < sform.listView2.Items.Count; i++)
            {
                listObj += sform.listView2.Items[i].Text + ";";
            }

            IfacesEnumsStructsClasses.IHTMLElement2          e2 = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            IfacesEnumsStructsClasses.IHTMLElementCollection c  = (e2.getElementsByTagName("input")) as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c == null)
            {
                return(null);
            }
            foreach (IfacesEnumsStructsClasses.IHTMLElement ce in c)
            {
                e = ce;
                break;
            }

            e.setAttribute("listObj", listObj, 1);
            e.setAttribute("action", sform.textBox1.Text, 1);

            return(e);
        }
Ejemplo n.º 7
0
        public void updateElement2(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            IfacesEnumsStructsClasses.IHTMLElement2 e2 = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            if (e2 == null)
            {
                return;
            }


            IfacesEnumsStructsClasses.IHTMLElementCollection c = (e2.getElementsByTagName("table")) as IfacesEnumsStructsClasses.IHTMLElementCollection;

            IfacesEnumsStructsClasses.IHTMLElement contentTbl = null;// (IfacesEnumsStructsClasses.IHTMLElement)(e2.getElementsByTagName("table"));

            foreach (IfacesEnumsStructsClasses.IHTMLElement te in c)
            {
                contentTbl = te;
                break;
            }
            IfacesEnumsStructsClasses.IHTMLDOMNode nod = (IfacesEnumsStructsClasses.IHTMLDOMNode)e;
            HtmlElement he = null;

            if (contentTbl != null)
            {
                nod = (IfacesEnumsStructsClasses.IHTMLDOMNode)(contentTbl.parentElement);
                //he = (e) as HtmlElement;
            }

            nod.removeChild(nod.firstChild);

            string html = this.getContent();


            he.InnerHtml = html;

            return;
        }
Ejemplo n.º 8
0
        public IfacesEnumsStructsClasses.IHTMLElement updateElement(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            IfacesEnumsStructsClasses.IHTMLElement2 e2 = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            if (e2 == null)
            {
                return(null);
            }

            IfacesEnumsStructsClasses.IHTMLElementCollection c = (e2.getElementsByTagName("table")) as IfacesEnumsStructsClasses.IHTMLElementCollection;

            IfacesEnumsStructsClasses.IHTMLElement contentTbl = null;// (IfacesEnumsStructsClasses.IHTMLElement)(e2.getElementsByTagName("table"));

            foreach (IfacesEnumsStructsClasses.IHTMLElement te in c)
            {
                contentTbl = te;
                break;
            }
            IfacesEnumsStructsClasses.IHTMLDOMNode nod = (IfacesEnumsStructsClasses.IHTMLDOMNode)e;

            if (contentTbl != null)
            {
                nod = (IfacesEnumsStructsClasses.IHTMLDOMNode)(contentTbl.parentElement);
            }

            nod.removeChild(nod.firstChild);



            IfacesEnumsStructsClasses.IHTMLDocument2 doc = (IfacesEnumsStructsClasses.IHTMLDocument2)(e.document);


            IfacesEnumsStructsClasses.IHTMLElement tbl   = doc.createElement("table");
            IfacesEnumsStructsClasses.IHTMLElement tbldy = doc.createElement("tbody");

            IfacesEnumsStructsClasses.IHTMLElement tr = doc.createElement("tr");
            IfacesEnumsStructsClasses.IHTMLElement td = doc.createElement("td");
            //   IfacesEnumsStructsClasses.IHTMLDOMTextNode td = doc.createElement("td");


            td.innerHTML = this.title.Text;

            // appendNewChild((IfacesEnumsStructsClasses.IHTMLElement)nod, tbl);
            appendNewChild(tbl, tr);
            appendNewChild(tr, td);


            tr           = doc.createElement("tr");
            td           = doc.createElement("td");
            td.innerHTML = this.description.Text;
            appendNewChild(tr, td);
            appendNewChild(tbl, tr);


            tr = doc.createElement("tr");
            td = doc.createElement("td");


            string groupname = new Random().Next().ToString();

            for (int i = 0; i < this.listView1.Items.Count; i++)
            {
                IfacesEnumsStructsClasses.IHTMLElement inpute = doc.createElement("input");
                inpute.setAttribute("type", "radio", 1);
                if (this.listView1.Items[i].Tag != null)
                {
                    inpute.setAttribute("name", this.listView1.Items[i].Tag.ToString(), 1);
                    groupname = this.listView1.Items[i].Tag.ToString();
                }

                else
                {
                    inpute.setAttribute("name", groupname, 1);
                }
                inpute.setAttribute("value", this.listView1.Items[i].Text, 1);
                string radioid = groupname + "_" + (i + 1).ToString();
                inpute.setAttribute("id", radioid, 1);
                IfacesEnumsStructsClasses.IHTMLElement br = doc.createElement("br");

                //    inpute.innerText =  this.listView1.Items[i].Text;
                appendNewChild(td, inpute);
                //td.insertAdjacentText("", this.listView1.Items[i].Text);
                td.innerHTML += this.listView1.Items[i].Text;
                appendNewChild(td, br);
            }
            appendNewChild(tr, td);
            appendNewChild(tbl, tr);

            tbl.style.lineHeight = "24px";
            tbl.style.fontSize   = "12px";
            IfacesEnumsStructsClasses.IHTMLElement node = (IfacesEnumsStructsClasses.IHTMLElement)nod;
            string hs = tbl.outerHTML;

            Encoding ec = Encoding.GetEncoding("gb2312");

            hs = ec.GetString(System.Text.Encoding.Default.GetBytes(hs));

            node.innerHTML = hs;
            return(tbl);
        }
Ejemplo n.º 9
0
        public IfacesEnumsStructsClasses.IHTMLElement updateElement(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            IfacesEnumsStructsClasses.IHTMLElement2 e2 = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            if (e2 == null)
            {
                return(null);
            }

            IfacesEnumsStructsClasses.IHTMLElementCollection c = (e2.getElementsByTagName("table")) as IfacesEnumsStructsClasses.IHTMLElementCollection;

            IfacesEnumsStructsClasses.IHTMLElement contentTbl = null;// (IfacesEnumsStructsClasses.IHTMLElement)(e2.getElementsByTagName("table"));

            foreach (IfacesEnumsStructsClasses.IHTMLElement te in c)
            {
                contentTbl = te;
                break;
            }
            IfacesEnumsStructsClasses.IHTMLDOMNode nod = (IfacesEnumsStructsClasses.IHTMLDOMNode)e;

            if (contentTbl != null)
            {
                nod = (IfacesEnumsStructsClasses.IHTMLDOMNode)(contentTbl.parentElement);
            }

            nod.removeChild(nod.firstChild);



            IfacesEnumsStructsClasses.IHTMLDocument2 doc = (IfacesEnumsStructsClasses.IHTMLDocument2)(e.document);


            IfacesEnumsStructsClasses.IHTMLElement tbl   = doc.createElement("table");
            IfacesEnumsStructsClasses.IHTMLElement tbldy = doc.createElement("tbody");

            IfacesEnumsStructsClasses.IHTMLElement tr = doc.createElement("tr");
            IfacesEnumsStructsClasses.IHTMLElement td = doc.createElement("td");
            //   IfacesEnumsStructsClasses.IHTMLDOMTextNode td = doc.createElement("td");


            td.innerHTML = this.title.Text;

            appendNewChild((IfacesEnumsStructsClasses.IHTMLElement)nod, tbl);
            appendNewChild(tbl, tr);
            appendNewChild(tr, td);


            tr           = doc.createElement("tr");
            td           = doc.createElement("td");
            td.innerHTML = this.description.Text;
            appendNewChild(tr, td);
            appendNewChild(tbl, tr);


            tr = doc.createElement("tr");
            td = doc.createElement("td");


            string groupname = new Random().Next().ToString();

            for (int i = 0; i < this.listView1.Items.Count; i++)
            {
                IfacesEnumsStructsClasses.IHTMLElement inpute = doc.createElement("input");
                inpute.setAttribute("type", "radio", 1);
                if (this.listView1.Items[i].Tag != null)
                {
                    inpute.setAttribute("name", this.listView1.Items[i].Tag.ToString(), 1);
                    groupname = this.listView1.Items[i].Tag.ToString();
                }

                else
                {
                    inpute.setAttribute("name", groupname, 1);
                }
                inpute.setAttribute("value", this.listView1.Items[i].Text, 1);
                IfacesEnumsStructsClasses.IHTMLElement br = doc.createElement("br");

                //    inpute.innerText =  this.listView1.Items[i].Text;
                appendNewChild(td, inpute);
                //td.insertAdjacentText("", this.listView1.Items[i].Text);
                td.innerHTML += this.listView1.Items[i].Text;
                appendNewChild(td, br);
            }
            appendNewChild(tr, td);
            appendNewChild(tbl, tr);


            return(tbl);
        }
Ejemplo n.º 10
0
        override public IfacesEnumsStructsClasses.IHTMLElement loadInfoFromElement(IfacesEnumsStructsClasses.IHTMLElement e)
        {
            if (e == null)
            {
                return(null);
            }


            IfacesEnumsStructsClasses.IHTMLElement2          e2 = (IfacesEnumsStructsClasses.IHTMLElement2)e;
            IfacesEnumsStructsClasses.IHTMLElementCollection c  = (e2.getElementsByTagName("label")) as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c == null)
            {
                return(null);
            }
            foreach (IfacesEnumsStructsClasses.IHTMLElement ce in c)
            {
                e = ce;
                break;
            }

            IfacesEnumsStructsClasses.IHTMLElement titlee = (IfacesEnumsStructsClasses.IHTMLElement)e;
            iframeForm form = new iframeForm();

            form.textBox1.Text = e.innerText;


            c = (e2.getElementsByTagName("iframe")) as IfacesEnumsStructsClasses.IHTMLElementCollection;
            if (c == null)
            {
                return(null);
            }
            foreach (IfacesEnumsStructsClasses.IHTMLElement ce in c)
            {
                e = ce;
                break;
            }
            if (e.getAttribute("src", 1) != null)
            {
                string http = e.getAttribute("src", 1).ToString();;
                http = http.Replace("http://", "");
                form.textBox2.Text = http;
            }
            if (form.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return(null);
            }
            string url = form.textBox2.Text;

            if (!url.StartsWith("http://"))
            {
                url = "http://" + url;
            }
            string title = form.textBox1.Text;

            if (title.Equals(""))
            {
                title = url;
            }

            e.setAttribute("src", url, 1);
            titlee.innerText = title;
            return(e);

            //IfacesEnumsStructsClasses.IHTMLDocument2 doc = (IfacesEnumsStructsClasses.IHTMLDocument2)e.document;
            // doc.foc
        }