Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
#if false
            //LoadHtml() throw assert
            m_wb.LoadHtml(@"<!DOCTYPE html>
             <html><head>
             <meta http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"">
             <script type=""text/javascript"">
                function fireEvent(name, data)
                {
                   var event = new MessageEvent(name,{'view': window, 'bubbles': false, 'cancelable': false, 'data': data});
                   document.dispatchEvent(event);
                }
             </script>
             </head>
             <body>fdsfsda
                <input type=""button"" onclick=""fireEvent('myFunction', 'some data');"" value=""SHOW DATA"" />
             </body></html>"
                          );

            m_wb.AddMessageEventListener("myFunction", ((string s) => MessageBox.Show(s)));
#endif

            m_wb.AddMessageEventListener("func1", onFunc1);
            m_wb.Navigate(@"C:\temp\until\KinhNikaya\testGUI\click.html");
        }
Beispiel #2
0
        protected void UpdateWB(string htmlTxt)
        {
#if use_gecko
            string filename = string.Format(@"{0}\{1}", Path.GetTempPath(), "page.htm");
            File.WriteAllText(filename, htmlTxt);
            m_wb.Navigate(filename);
#elif use_chromium
            m_wb.LoadHtml(htmlTxt, "http://test/page");
#else
            m_wb.DocumentText = htmlTxt;
#endif
            //OpenInBrowser(htmlTxt);
        }
Beispiel #3
0
        protected virtual void InitCtrls()
        {
            var tbl = new TableLayoutPanel();

            tbl.Dock = DockStyle.Fill;
            var spl = new SplitContainer();

            spl.Dock             = DockStyle.Fill;
            spl.Orientation      = Orientation.Vertical; // spl1 | spl2
            spl.FixedPanel       = FixedPanel.Panel1;
            spl.SplitterDistance = 150;

            tbl.Controls.Add(spl);
            var pg = new TabPage();

            pg.Controls.Add(tbl);

            var trvw = new TreeView();

            //var trvw  = new RikTheVeggie.TriStateTreeView();
            trvw.Dock = DockStyle.Fill;
            //trvw.CheckBoxes = true;
            spl.Panel1.Controls.Add(trvw);

            m_treeCms = new ContextMenuStrip();
            var mi = m_treeCms.Items.Add("Refresh");

            mi.Click += TCMS_RefreshClick;
#if use_gecko
            var wb = new Gecko.GeckoWebBrowser();
            wb.LoadHtml("<html><body></body></html>", "http://blank");
#elif use_chromium
            if (!Cef.IsInitialized)
            {
                var settings = new CefSettings();
                CefSharp.Cef.Initialize(settings);
            }
            var wb = new ChromiumWebBrowser("");
#else
            var wb = new WebBrowser();
#endif
            wb.Dock = DockStyle.Fill;
            spl.Panel2.Controls.Add(wb);

            //save control handles
            m_wb   = wb;
            m_tree = trvw;
            m_pg   = pg;
            m_tbl  = tbl;
            m_spl  = spl;
        }