Beispiel #1
0
        private static void createhtml(outline outline, string dir)
        {
            FileStream   fi;
            StreamWriter sw;

            if (outline.children.Count == 0)
            {
                #region outlinetype.common
                if (outline.type == outlinetype.common)
                {
                    article dd = new article(outline.nodename);
                    //FileStream fi = new FileStream(dir + "\\" + "section" + ((XmlElement)root).GetAttribute("id") + ".html", FileMode.Create);
                    fi = new FileStream(dir + "\\" + outline.nodename + ".html", FileMode.Create);
                    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("<script type=\"text/javascript\" src=\"change.js\"></script>");
                    //sw.WriteLine("<title>" + tree5_sel.Name + "</title>");
                    sw.WriteLine("</head>");
                    sw.WriteLine("<body>");
                    sw.WriteLine("<script type=\"text/javascript\" src=\"wz_tooltip.js\"></script>");
                    if (outline.nodename == "CatalogOutline")
                    {
                        sw.WriteLine(gethtmlcode(updateEVENT_WPFTOJS(dd.getcontext_comm(), 1)));
                    }
                    else if (outline.nodename == "CatalogFig")
                    {
                        sw.WriteLine(gethtmlcode(updateEVENT_WPFTOJS(dd.getcontext_comm(), 3)));
                    }
                    else
                    {
                        sw.WriteLine(gethtmlcode(dd.getcontext_comm()));
                    }
                    sw.WriteLine("</body>");
                    sw.WriteLine("</html>");
                    sw.Flush();
                    sw.Close();
                    fi.Close();
                    create_leftnode(outline, sws);
                }
                #endregion
                #region outlinetype.section
                else
                {
                    article dd = new article(outline.secid, "Papersection/" + outline.nodename);
                    fi = new FileStream(dir + "\\" + "section" + outline.secid + ".html", FileMode.Create);
                    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("<script type=\"text/javascript\" src=\"change.js\"></script>");
                    sw.WriteLine("</head>");
                    sw.WriteLine("<body>");
        }  //增加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("&amp;", "&"));
                        }
                    }
                    else
                    {
                        article dd = new article(tree6_sel.nodename);

                        if (invoker.WaitWebPageLoad() == true)
                        {
                            invoker.InvokeScript("setContent", dd.getcontext_comm().Replace("&amp;", "&"));
                        }
                    }
                }
                issave = true;
            }
            catch
            {
                if (invoker.WaitWebPageLoad() == true)
                {
                    invoker.InvokeScript("setContent", "");
                }
            }
        }