コード例 #1
0
ファイル: Form1.cs プロジェクト: Asgar786/HTML-CSS-Notepad
        private void htmlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HtmlCssData hs = new HtmlCssData();

            document = hs.GetHtmlStructure;
            string filePath = Application.StartupPath;

            document.Save(filePath + "/tempHtml.txt");

            richTextBox1.LoadFile(filePath + "/tempHtml.txt", RichTextBoxStreamType.PlainText);
            using (Document d = Document.FromString(richTextBox1.Text))
            {
                d.IndentBlockElements = AutoBool.Yes;
                d.IndentSpaces        = 2;
                d.AddTidyMetaElement  = false;
                d.CleanAndRepair();
                d.Save(filePath + "/tempHtml.txt");
            }

            document.Load(filePath + "/tempHtml.txt");
            richTextBox1.Clear();
            richTextBox1.LoadFile(filePath + "/tempHtml.txt", RichTextBoxStreamType.PlainText);
            this.ColorHtmlTag();
            //view.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();
            //builder.Dock = DockStyle.Fill ;
            // this.Controls.Add(builder);
            //  builder.BringToFront();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Asgar786/HTML-CSS-Notepad
        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();
            }
        }