Exemplo n.º 1
0
        private async void htmlToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter           = "Html File(.html)|*.html";
            openFileDialog1.RestoreDirectory = true;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.PlainText);
                document.LoadHtml(richTextBox1.Text);
                document.Save(Application.StartupPath + "/tempHtml.txt");

                Thread.Sleep(1000);
                this.ColorHtmlTag();
                await view.EnsureCoreWebView2Async(null);

                view.CoreWebView2.NavigateToString(richTextBox1.Text);
                treeView1.Nodes.Clear();
                treeView1.Nodes.Add(document.DocumentNode.Name);
                TreeViewMethods.BindTreeView(document.DocumentNode, treeView1.Nodes[0]);
                htmlElementToolStripMenuItem1.Enabled = false;
                builder.Dispose();
                builder = new CssBulderControl1();
            }
        }