コード例 #1
0
 public void setDocNameDesp()
 {
     if (pform == null)
     {
         return;
     }
     IfacesEnumsStructsClasses.IHTMLDocument2 doc = pform.cEXWB1.GetActiveDocument();
     IfacesEnumsStructsClasses.IHTMLElement   bd  = (IfacesEnumsStructsClasses.IHTMLElement)doc.body;
     bd.setAttribute("tname", name, 1);
     bd.setAttribute("tdescription", description, 1);
     bd.setAttribute("ID", ID, 1);
     pform.Text = "模版:" + name;
 }
コード例 #2
0
ファイル: templateBase.cs プロジェクト: send2vinnie/1709
        public void saveToDB()
        {
            templateCreateForm tcf = new templateCreateForm();

            tcf.textBox1.Text = this.name;
            tcf.textBox2.Text = this.description;
            if (tcf.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            IfacesEnumsStructsClasses.IHTMLDocument2 doc = pform.cEXWB1.GetActiveDocument();
            IfacesEnumsStructsClasses.IHTMLElement   bd  = (IfacesEnumsStructsClasses.IHTMLElement)doc.body;
            this.name        = tcf.textBox1.Text;
            this.description = tcf.textBox2.Text;

            pform.Text = "模版:" + name;

            /*  object o = bd.getAttribute("tname", 1);
             * if (o != null && !o.ToString().Equals(""))
             *    name = o.ToString();
             *
             *
             * o = bd.getAttribute("tdescription", 1);
             * if (o != null && !o.ToString().Equals(""))
             *    description = o.ToString();
             *
             *
             * o = bd.getAttribute("ID", 1);
             * if (o != null && !o.ToString().Equals(""))
             *    ID = o.ToString();*/

            this.setDocNameDesp();


            string s = doc.body.outerHTML;

            //   Encoding ec = Encoding.GetEncoding("gb2312");
            //   s ="<html>"  + ec.GetString(System.Text.Encoding.Default.GetBytes(s)) + "</html>";
            s = "<html>" + s + "</html>";

            if (dbTools.dbTool.saveTemplate(name, s, description, ""))
            {
                MessageBox.Show("数据存储成功");
            }
            else
            {
                MessageBox.Show("数据存储失败");
            }
        }
コード例 #3
0
        private HTMLFrameBase SetFrame(IHTMLDocument2 doc)
        {
            if (doc == null)
            {
                return(null);
            }
            HTMLWindow2 frameCollection;

            try
            {
                frameCollection = doc.frames as HTMLWindow2;
                if (frameCollection == null)
                {
                    return(null);
                }
                frameCollection = frameCollection.frames as HTMLWindow2;
                if (frameCollection == null || frameCollection.frameElement == null)
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                return(null);
            }

            if (frameCollection.frameElement.GetType().GetInterface("IHTMLFrameElement") == null &&
                frameCollection.frameElement.GetType().GetInterface("IHTMLIFrameElement") == null)
            {
                return(null);
            }

            if (frameCollection.frameElement == null)
            {
                return(null);
            }
            var frameElement = (IHTMLElement)frameCollection.frameElement;
            var actionfinder = new FindAttributeCollection();

            actionfinder.ActionUrl = frameCollection.location.toString();
            List <FindAttribute> attributes = actionfinder.GetFindAttributes(frameElement);

            if (attributes.Count > 0)
            {
                ActionFrames.Add(actionfinder);
            }
            return((HTMLFrameBase)frameElement);
        }
コード例 #4
0
ファイル: templateBase.cs プロジェクト: send2vinnie/1709
        public void loadFromDB()
        {
            if (pform == null)
            {
                return;
            }

            dbTemplateForm dbt = new dbTemplateForm();

            dbt.ShowDialog();
            if (dbt.sel_template != null)
            {
                this.name = dbt.sel_template[0];
                string html = dbt.sel_template[1];
                this.description = dbt.sel_template[2];
                this.type        = dbt.sel_template[3];


                IfacesEnumsStructsClasses.IHTMLDocument2 doc = pform.cEXWB1.GetActiveDocument();

                mshtml.HTMLDocument docc = (mshtml.HTMLDocument)doc;

                // Encoding ec = Encoding.GetEncoding("gb2312");
                // html = ec.GetString(System.Text.Encoding.Default.GetBytes(html));



                string tempfilepath = Application.StartupPath;
                if (!tempfilepath.EndsWith("\\"))
                {
                    tempfilepath = tempfilepath + "\\";
                }

                tempfilepath = tempfilepath + "tempFile.html";

                System.IO.File.WriteAllText(tempfilepath, html, Encoding.GetEncoding("gb2312"));
                ///  docc.documentElement.innerHTML = html;
                //  docc.body.outerHTML = "<body><label>a</label></body>";
                this.setDocNameDesp();
                pform.cEXWB1.Navigate(tempfilepath);
            }
        }
コード例 #5
0
        public void appendLayout(ListViewItem item)
        {
            if (item == null)
            {
                return;
            }

            if (item.Tag == null)
            {
                return;
            }

            if (item.Tag is baseLayout)
            {
                try
                {
                    IfacesEnumsStructsClasses.IHTMLDocument2 doc2 = parentForm.cEXWB1.GetActiveDocument();

                    baseLayout ctrl = (baseLayout)(item.Tag);
                    if (item.Tag is layouts.table)
                    {
                        ctrl = (layouts.table)(item.Tag);
                    }

                    if (item.Tag is layouts.div)
                    {
                        ctrl = (layouts.div)(item.Tag);
                    }


                    string html = ctrl.createHtmlView();
                    parentForm.addControl(html);
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message);
                }
            }
        }
コード例 #6
0
ファイル: templateBase.cs プロジェクト: send2vinnie/1709
        public void getDocNameDesp()
        {
            if (pform == null)
            {
                return;
            }
            IfacesEnumsStructsClasses.IHTMLDocument2 doc = pform.cEXWB1.GetActiveDocument();
            IfacesEnumsStructsClasses.IHTMLElement   bd  = (IfacesEnumsStructsClasses.IHTMLElement)doc.body;
            object o = bd.getAttribute("tname", 1);

            if (o != null && !o.ToString().Equals(""))
            {
                name = o.ToString();
            }
            else
            {
                bd.setAttribute("tname", name, 1);
            }

            o = bd.getAttribute("tdescription", 1);
            if (o != null && !o.ToString().Equals(""))
            {
                description = o.ToString();
            }
            else
            {
                bd.setAttribute("tdescription", description, 1);
            }

            o = bd.getAttribute("ID", 1);
            if (o != null && !o.ToString().Equals(""))
            {
                ID = o.ToString();
            }
            else
            {
                bd.setAttribute("ID", ID, 1);
            }
        }
コード例 #7
0
ファイル: templateBase.cs プロジェクト: send2vinnie/1709
        public void saveAsFile(string path)
        {
            IfacesEnumsStructsClasses.IHTMLDocument2 doc2 = pform.cEXWB1.GetActiveDocument();
            string tempname = name;
            int    idx      = path.LastIndexOf("\\");

            tempname = path.Substring(idx + 1);

            idx      = tempname.IndexOf(".");
            tempname = tempname.Substring(0, idx);
            name     = tempname;

            this.setDocNameDesp();


            string s = "<html>" + doc2.body.outerHTML + "</html>";

            System.IO.File.WriteAllText(path, s, Encoding.GetEncoding("gb2312"));

            idx = path.LastIndexOf("\\");

            path = path.Substring(0, idx);


            System.IO.Directory.CreateDirectory(path + "\\icon");

            string rootpath = System.Windows.Forms.Application.StartupPath + "\\icon\\";

            string[] files = System.IO.Directory.GetFiles(rootpath);

            for (int i = 0; i < files.Length; i++)
            {
                int    sidex  = files[i].LastIndexOf("\\");
                string f      = files[i].Substring(sidex + 1);
                string fname  = rootpath + f;
                string fname2 = path + "\\icon\\" + f;
                System.IO.File.Copy(fname, fname2, true);
            }
        }
コード例 #8
0
        public void appendControl(ListViewItem item)
        {
            if (item == null)
            {
                return;
            }

            if (item.Tag == null)
            {
                return;
            }

            if (item.Tag is controlBase)
            {
                controlBase ctrl = (controlBase)(item.Tag);
                if (item.Tag is controls.alert)
                {
                    ctrl = (controls.alert)(item.Tag);
                }
                if (item.Tag is controls.brief)
                {
                    ctrl = (controls.brief)(item.Tag);
                }
                if (item.Tag is controls.information)
                {
                    ctrl = (controls.information)(item.Tag);
                }

                if (item.Tag is controls.rescueReq)
                {
                    ctrl = (controls.rescueReq)(item.Tag);
                }

                if (item.Tag is controls.rescuePlan)
                {
                    ctrl = (controls.rescuePlan)(item.Tag);
                }

                if (item.Tag is controls.radioSelection)
                {
                    ctrl = (controls.radioSelection)(item.Tag);
                }

                if (item.Tag is controls.textArea)
                {
                    ctrl = (controls.textArea)(item.Tag);
                }

                if (item.Tag is controls.submit)
                {
                    ctrl = (controlBase)(controls.submit.getCtrl(this.parentForm));
                }

                try
                {
                    IfacesEnumsStructsClasses.IHTMLDocument2 doc2 = parentForm.cEXWB1.GetActiveDocument();
                    if (item.Tag is controls.eframe)
                    {
                        parentForm.iframeLoadCount = 1;
                    }
                }
                catch (Exception exp)
                {
                }

                string html = ctrl.createHtmlView();
                parentForm.addControl(html);
            }
        }
コード例 #9
0
ファイル: radioForm.cs プロジェクト: send2vinnie/1709
        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);
        }
コード例 #10
0
ファイル: templateBase.cs プロジェクト: send2vinnie/1709
        public void saveToDB()
        {
            /* SaveForm save = new SaveForm();
             * if (save.ShowDialog() != System.Windows.Forms.DialogResult.OK)
             * {
             *   return;
             * }*/
            templateCreateForm tcf = new templateCreateForm();

            tcf.textBox1.Text = this.name;
            tcf.textBox2.Text = this.description;
            tcf.templatetype.SelectedIndex = templateBase.getSelectedIndex(this.type);

            if (tcf.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            IfacesEnumsStructsClasses.IHTMLDocument2 doc = pform.cEXWB1.GetActiveDocument();
            IfacesEnumsStructsClasses.IHTMLElement   bd  = (IfacesEnumsStructsClasses.IHTMLElement)doc.body;
            this.name        = tcf.textBox1.Text;
            this.description = tcf.textBox2.Text;
            this.type        = tcf.typeStr;

            pform.Text = "模版:" + name;

            /*  object o = bd.getAttribute("tname", 1);
             * if (o != null && !o.ToString().Equals(""))
             *    name = o.ToString();
             *
             *
             * o = bd.getAttribute("tdescription", 1);
             * if (o != null && !o.ToString().Equals(""))
             *    description = o.ToString();
             *
             *
             * o = bd.getAttribute("ID", 1);
             * if (o != null && !o.ToString().Equals(""))
             *    ID = o.ToString();*/
            this.setDocNameDesp();
            //bd.setAttribute("tname", name, 1);
            //bd.setAttribute("tdescription", description, 1);
            //bd.setAttribute("ID", ID, 1);
            //pform.Text = "模版:" + name;


            string s = doc.body.outerHTML;

            //Encoding ec = Encoding.GetEncoding("gb2312");
            // s ="<html>"  + ec.GetString(System.Text.Encoding.Default.GetBytes(s)) + "</html>";
            s = "<html>" + s;

            /*if (save.time.Text == "")
             * {
             *  s = s + "<endtime> template </endtime>";
             * }
             * else
             * {
             *  s = s + save.time.Text;
             * }
             * if (save.Expert.Text == "")
             * {
             *  s = s + "<expert> template </expert>";
             * }else
             * {
             *  s = s + save.Expert.Text;
             * }*/
            /*foreach (var key in s)
             * {
             *
             * }*/
            s = s + "</html>";

            if (dbTools.dbTool.saveTemplate(name, s, description, type, "1"))
            {
                MessageBox.Show("数据存储成功");
            }
            else
            {
                MessageBox.Show("数据存储失败");
            }
        }
コード例 #11
0
ファイル: templateBase.cs プロジェクト: send2vinnie/1709
        public void saveAsFile(string path)
        {
            /* SaveForm save = new SaveForm();
             * if (save.ShowDialog() != System.Windows.Forms.DialogResult.OK)
             * {
             *   return;
             * }*/
            templateCreateForm tcf = new templateCreateForm();

            IfacesEnumsStructsClasses.IHTMLDocument2 doc2 = pform.cEXWB1.GetActiveDocument();
            string tempname = name;
            int    idx      = path.LastIndexOf("\\");

            tempname = path.Substring(idx + 1);

            idx      = tempname.IndexOf(".");
            tempname = tempname.Substring(0, idx);
            name     = tempname;

            this.setDocNameDesp();


            string s = "<html>" + doc2.body.outerHTML;

            /*if (save.time.Text == "")
             * {
             *  s = s + "<endtime> template </endtime>";
             * }
             * else
             * {
             *  s = s + save.time.Text;
             * }
             * if (save.Expert.Text == "")
             * {
             *  s = s + "<expert> template </expert>";
             * }
             * else
             * {
             *  s = s + save.Expert.Text;
             * }*/
            s = s + "</html>";

            System.IO.File.WriteAllText(path, s, Encoding.GetEncoding("gb2312"));

            idx = path.LastIndexOf("\\");

            path = path.Substring(0, idx);


            System.IO.Directory.CreateDirectory(path + "\\icon");

            string rootpath = System.Windows.Forms.Application.StartupPath + "\\icon\\";

            string[] files = System.IO.Directory.GetFiles(rootpath);

            for (int i = 0; i < files.Length; i++)
            {
                int    sidex  = files[i].LastIndexOf("\\");
                string f      = files[i].Substring(sidex + 1);
                string fname  = rootpath + f;
                string fname2 = path + "\\icon\\" + f;
                if (fname != fname2)
                {
                    System.IO.File.Copy(fname, fname2, true);
                }
            }
        }
コード例 #12
0
ファイル: radioForm.cs プロジェクト: send2vinnie/1709
        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);
        }