private void buttonRegisterCSharpObject_Click(object sender, EventArgs e) { m_jsInteractionObj = new JavaScriptInteractionObj(); m_jsInteractionObj.SetChromeBrowser(m_chromeBrowser); // Register the JavaScriptInteractionObj class with JS m_chromeBrowser.RegisterJsObject("winformObj", m_jsInteractionObj); string page = string.Format("{0}HTMLResources/html/WinformInteractionExample.html", GetAppLocation()); m_chromeBrowser.Load(page); }
private void buttonRegisterCSharpObject_Click(object sender, EventArgs e) { //To register a JS object, it must occur immediate after the browser has been created //So in this instance we'll create a new browser; panel1.Controls.Remove(m_chromeBrowser); var page = new Uri(string.Format("file:///{0}HTMLResources/html/WinformInteractionExample.html", GetAppLocation())); m_chromeBrowser = new ChromiumWebBrowser(page.ToString()); panel1.Controls.Add(m_chromeBrowser); m_jsInteractionObj = new JavaScriptInteractionObj(); m_jsInteractionObj.SetChromeBrowser(m_chromeBrowser); // Register the JavaScriptInteractionObj class with JS m_chromeBrowser.RegisterJsObject("winformObj", m_jsInteractionObj); }