Ejemplo n.º 1
0
        public static void export(iDissertation tree5_sel, string todire)
        {
            FileStream   fi = new FileStream(MainWindow.idd_href + "\\" + tree5_sel.Name + ".html", FileMode.Create);
            StreamWriter sw = new StreamWriter(fi, Encoding.Default);

            sw.WriteLine("<!doctype html>");
            sw.WriteLine("<html lang=\"en\">");
            sw.WriteLine("<head>");
            sw.WriteLine("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"/>");
            sw.WriteLine("<title>" + tree5_sel.Name + "</title>");
            sw.WriteLine("</head>");
            sw.WriteLine("<body>");
            XmlDocument ep = new XmlDocument();

            ep.Load(xml_style);
            XmlNodeList context = ep.DocumentElement.ChildNodes;

            foreach (XmlNode xm in context)
            {
                string html = ((XmlElement)xm).InnerXml.ToString().Replace(tree5_sel.href + "\\", "");
                html = html.Replace("dialogs\\video\\", "");
                sw.WriteLine(html);
            }
            sw.WriteLine("</body>");
            sw.WriteLine("</html>");
            sw.Flush();
            sw.Close();
            fi.Close();
            copy_files.copyfile(tree5_sel.href, todire);
        }
Ejemplo n.º 2
0
        private void m_window1_idd_NameChanged(object sender, Window1.textEventArgs e)
        {
            //获取事件传递过来的数据
            newname = e.textbox;

            iDissertation sel = (iDissertation)tree5.SelectedItem;

            idisser_data.idisser.TreeViewItems4_modify(sel, newname);
            sel.Name = newname;
        }
Ejemplo n.º 3
0
 public void TreeViewItems4_modify(iDissertation newtitle, string newname)
 {
     foreach (XmlNode xm in root.ChildNodes)
     {
         if (((XmlElement)xm).GetAttribute("name") == newtitle.Name)
         {
             ((XmlElement)xm).SetAttribute("name", newname);
         }
     }
     doc.Save("iDissertation.xml");
 }
Ejemplo n.º 4
0
        private void createidsst(object sender, Window1.textEventArgs e1, Window4.idssSelect e2)
        {
            //this.tree5.Items.Add();
            iDissertation newite = new iDissertation()
            {
                Name     = e1.textbox,
                icon     = e2.newtitle.Pic,
                nodetype = e2.type,
                href     = item_Directory + "\\" + e1.textbox
            };

            idisser_data.idisser.TreeViewItems4_add(newite);
        }  //增加idis项
Ejemplo n.º 5
0
        private void delete_idd_title(object sender, RoutedEventArgs e)
        {
            isselect = false;
            idisser_data  delete = new idisser_data();
            iDissertation dd     = (iDissertation)tree5.SelectedItem;

            //idisser_data.idisser.TreeViewItems4.Remove(dd);
            // Directory.Delete(dd.href);

            delete.TreeViewItems4_delete(dd);
            this.tree6.ItemsSource = null;
            isselect = true;
        }
Ejemplo n.º 6
0
 public void TreeViewItems4_delete(iDissertation newtitle)
 {
     foreach (XmlNode xm in root.ChildNodes)
     {
         if (((XmlElement)xm).GetAttribute("name") == newtitle.Name)
         {
             root.RemoveChild(xm);
         }
     }
     doc.Save("iDissertation.xml");
     //TreeViewItems4.Remove(newtitle);
     idisser_data.idisser.TreeViewItems4.Remove(newtitle);
     copy_files.DeleteDir(newtitle.href);
 }
Ejemplo n.º 7
0
        private ObservableCollection <iDissertation> getidisser_data()
        {
            ObservableCollection <iDissertation> item = new ObservableCollection <iDissertation>();
            //XmlNode root = doc.DocumentElement;
            XmlNodeList xmllist = root.ChildNodes;

            foreach (XmlNode xm in xmllist)
            {
                iDissertation node = new iDissertation()
                {
                    icon = Window4.icons[int.Parse(((XmlElement)xm).GetAttribute("type"))],
                    Name = (((XmlElement)xm).GetAttribute("name")),
                    //nodetype=(iDissType)(int.Parse(((XmlElement)xm.SelectSingleNode("type")).InnerText)
                    nodetype = (iDissType)(int.Parse(((XmlElement)xm).GetAttribute("type"))),
                    href     = (((XmlElement)xm).GetAttribute("href"))
                               // parent=null
                };
                item.Add(node);
            }
            return(item);
        }
Ejemplo n.º 8
0
 private void tree5_SelectedItemChanged_1(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     //this.tree6.ItemsSource = null;
     if (isselect)
     {
         issave = false;
         // if (tree6_sel.type != outlinetype.empty && tree6_sel.Name1 != null)
         //{
         //  savexml(tree6_sel, savecontext);
         //  }
         web_show              = true;
         listView1.Visibility  = Visibility.Hidden;
         this.tree6.Visibility = Visibility.Visible;
         tree5_sel             = (iDissertation)tree5.SelectedItem;
         // newname = tree5_sel.Name;
         idd_href     = tree5_sel.href;
         select_tree5 = new outline_Data(true);
         // MessageBox.Show(idd_href);
         this.tree6.ItemsSource = select_tree5.TreeViewItems1;
     }
     //this.webBrowser1.Navigate("d:\\muban\\index_Paper.html");
 }
Ejemplo n.º 9
0
        public void TreeViewItems4_add(iDissertation newtitle)  //增点一个idd项
        {
            Directory.CreateDirectory(newtitle.href);
            Directory.CreateDirectory(newtitle.href + "\\music");
            // Directory.CreateDirectory(newtitle.href + "\\video");
            Directory.CreateDirectory(newtitle.href + "\\picture");
            Directory.CreateDirectory(newtitle.href + "\\music");
            idisser_data.idisser.TreeViewItems4.Add(newtitle);
            XmlElement xe1 = doc.CreateElement("item");                     //创建一个节点

            xe1.SetAttribute("id", (_TreeViewItems4.Count + 1).ToString()); //设置该节点id属性
            xe1.SetAttribute("name", newtitle.Name);                        //设置该节点name属性
            xe1.SetAttribute("type", ((int)newtitle.nodetype).ToString());  //设置该节点type属性
            xe1.SetAttribute("href", newtitle.href);                        //设置节点的href
            root.AppendChild(xe1);
            doc.Save("iDissertation.xml");
            // cf = new copy_files(System.Environment.CurrentDirectory.ToString()+"\\"+((int)newtitle.nodetype).ToString(), newtitle.href);
            copy_files.copyfile(System.Environment.CurrentDirectory.ToString() + "\\" + ((int)newtitle.nodetype).ToString(), newtitle.href);
            Savexml sa = new Savexml(newtitle.href);

            sa.init_idis();
            //Directory.CreateDirectory(newtitle.href);
        }