public void update(outline ch) { XmlDocument doc = new XmlDocument(); if (ch.context == null) { article dd = new article(ch.secid, "Papersection/" + ch.nodename); ch.context = dd.getcontext(); doc.LoadXml(ch.context); } else { doc.LoadXml(ch.context.Replace("&", "&")); } XmlNode xml = doc.DocumentElement.FirstChild; do { XmlNodeList sups = xml.SelectNodes("span/span/sup"); if (sups.Count > 0) { foreach (XmlNode cc in sups) { if (cc.Attributes.Count != 0) { referStartNumber++; //refer_context=MainWindow.tree5_sel.Refer[MainWindow.tree5_sel.Refernumber[referStartNumber - 1] - 1].Context; MainWindow.tree5_sel.Refernumber.Add(cd[int.Parse(((XmlElement)cc).GetAttribute("id")) - 1]); ((XmlElement)cc).SetAttribute("id", referStartNumber.ToString()); ((XmlElement)cc).SetAttribute("onClick", "window.external.MN_showreferinfo(\"" + referStartNumber.ToString() + "\")"); cc.InnerText = "[" + referStartNumber + "]"; } } } xml = xml.NextSibling; } while (xml != null); ch.context = doc.InnerXml.Replace("&", "&"); }
public void updatetitle(outline ch) { try { XmlDocument doc = new XmlDocument(); if (ch.context == null) { article dd = new article(ch.secid, "Papersection/" + ch.nodename); ch.context = dd.getcontext(); doc.LoadXml(ch.context); } else { doc.LoadXml(ch.context.Replace("&", "&")); } //XmlDocument doc = new XmlDocument(); //doc.LoadXml(ch.context); XmlNodeList xml = doc.DocumentElement.SelectNodes("p"); foreach (XmlNode xm in xml) { if (((XmlElement)xm).GetAttribute("name") == "msocaption") { cou++; Picture_ChartInfo newone = null; ((XmlElement)xm).SetAttribute("id", cou.ToString()); xm.FirstChild.InnerText = "图" + chapter.secid.ToString() + "-" + cou.ToString() + " "; XmlNode xms = xm.PreviousSibling.FirstChild.FirstChild.SelectSingleNode("img"); if (xms == null) { newone = new Picture_ChartInfo() { ownsection = ch.secid, title = xm.InnerText, path = "" } } ; else { newone = new Picture_ChartInfo() { ownsection = ch.secid, title = xm.InnerText, path = ((XmlElement)xms).GetAttribute("src") } }; chapter.CatalogFig.Add(newone); } } ch.context = doc.InnerXml.Replace("&", "&"); foreach (outline ou in ch.children) { updatetitle(ou); } } catch { ; } // ; }
} //增加idis项 private void tree6_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { //ThreadPool.QueueUserWorkItem(status=>savexml(tree6_sel)); if (issave == true) { // if(savecontext!=null) if (tree6_sel.type != outlinetype.empty && tree6_sel.Name1 != null) { savecontext = invoker.InvokeScript("getContent").ToString(); savexml(tree6_sel, savecontext); } } try { tree6_sel = this.tree6.SelectedItem as outline; textBox2.Text = tree6_sel.Name1; //tree6_sel.Name1 = "1111"; //tree6_sel = tree6.SelectedItem as outline; if (tree6_sel.type != outlinetype.common) { this.tree6.ContextMenu = c5; } else { this.tree6.ContextMenu = null; } // iDissertation ccc = tree5.SelectedItem as iDissertation; if (tree6_sel.Name1.Contains("封面") == true || tree6_sel.nodename == "Statement") { //string filepath = item_Directory; // cd = "../../" + filepath + "/article_xml/"; //string cccc = ccc.href; string cd = idd_href + "/" + tree6_sel.href; //cd = cd + cc.href.Replace("..", ""); this.webBrowser1.Navigate(@cd); web_show = true; } else { if (web_show) { this.webBrowser1.Navigate("file:///F:/ueditor1_3_6-src_tofuchangli/ueditor1_3_6-src/index.html"); web_show = false; } if (tree6_sel.type != outlinetype.common) { article dd = new article(tree6_sel.secid, "Papersection/" + tree6_sel.nodename); if (invoker.WaitWebPageLoad() == true) { invoker.InvokeScript("setContent", dd.getcontext().Replace("&", "&")); } } else { article dd = new article(tree6_sel.nodename); if (invoker.WaitWebPageLoad() == true) { invoker.InvokeScript("setContent", dd.getcontext_comm().Replace("&", "&")); } } } issave = true; } catch { if (invoker.WaitWebPageLoad() == true) { invoker.InvokeScript("setContent", ""); } } }