예제 #1
0
        public void openDefault()
        {
            templateCreateForm cf = new templateCreateForm();

            if (cf.ShowDialog() == DialogResult.OK)
            {
                name        = cf.textBox1.Text;
                description = cf.textBox2.Text;
                this.setDocNameDesp();
                loadDefault();
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     connectString = "";
     type = 0;
     templateCreateForm cf = new templateCreateForm();
     if (cf.ShowDialog() == DialogResult.OK)
     {
         tname = cf.textBox1.Text;
         tdescription = cf.textBox2.Text;
         this.Close();
     }
 }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            connectString = "";
            type          = 0;
            templateCreateForm cf = new templateCreateForm();

            if (cf.ShowDialog() == DialogResult.OK)
            {
                tname        = cf.textBox1.Text;
                tdescription = cf.textBox2.Text;
                this.Close();
            }
        }
예제 #4
0
        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("数据存储失败");
            }
        }
예제 #5
0
        public void setTemplate()
        {
            templateCreateForm tcf = new templateCreateForm();

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



            this.name        = tcf.textBox1.Text;
            this.description = tcf.textBox2.Text;



            this.setDocNameDesp();
        }
        public void setTemplate()
        {
            templateCreateForm tcf = new templateCreateForm();
            tcf.textBox1.Text = this.name;
            tcf.textBox2.Text = this.description;
            if (tcf.ShowDialog() != DialogResult.OK)
                return;

            this.name = tcf.textBox1.Text;
            this.description = tcf.textBox2.Text;

            this.setDocNameDesp();
        }
        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;
            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;
            /*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, ""))
                MessageBox.Show("数据存储成功");
            else MessageBox.Show("数据存储失败");
        }
        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);
                }
            }
        }
 public void openDefault()
 {
     templateCreateForm cf = new templateCreateForm();
     if (cf.ShowDialog() == DialogResult.OK)
     {
         name = cf.textBox1.Text;
         description = cf.textBox2.Text;
         this.setDocNameDesp();
         loadDefault();
     }
 }
예제 #10
0
        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
        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);
                }
            }
        }