Пример #1
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string fname = dlg.FileName;
                StreamReader str = File.OpenText(dlg.FileName);
                tbIn.Text = str.ReadToEnd();

                XmlDocument doc = new XmlDocument();

                doc.Load(fname);

                svgIn.SRC = fname;

                _e = SvgFactory.LoadFromXML(doc, null);

                string output = _e.WriteSVGString(true);

                tbOut.Text = output;

                StreamWriter tw = new StreamWriter("c:\\temp\\foo.svg", false);

                tw.Write(output);

                tw.Close();

                svgOut.SRC = "c:\\temp\\foo.svg";
            }
        }
Пример #2
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string fname = dlg.FileName;
                StreamReader str = File.OpenText(dlg.FileName);
                tbIn.Text = str.ReadToEnd();

                XmlDocument doc = new XmlDocument();

                doc.Load(fname);

                svgIn.Navigate(new Uri(fname));
                svgIn.Refresh(WebBrowserRefreshOption.Completely);

                _e = SvgFactory.LoadFromXML(doc, null);

                string output = _e.WriteSVGString(true);

                tbOut.Text = output;

                string tempFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foo.svg");

                StreamWriter tw = new StreamWriter(tempFile, false);

                tw.Write(output);

                tw.Close();

                svgOut.Navigate(new Uri(tempFile));
                svgOut.Refresh(WebBrowserRefreshOption.Completely);
            }
        }