I'm looking for a way to run my Angular2
application in a CefSharp
control and establish a communication in both directions. Let me give you two examples:
- I have a button in my Angular app and want my CefSharp to output a message box (Only as an example). I know how to get into the javascript code, but I can't compile my AngularApp, if you add a class from the C#, because it doesn't know this.
C# code:
private void RegisterJsObjects()
{
_browser.RegisterJsObject("cefTestClass", new TestClass());
}
class TestClass
{
public void csF(string message)
{
MessageBox.Show(message, "#C", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
}
}
Angular code:
<button (click) ="cefTestClass.csF('text')"> C# Button </button>
- I want to call
Angular
functions from myCefSharp
application, because they get different names after compiling, I can't get access to them.