Hi Takao,
Yes it is!
Set up your JavaScript like this (Note: if you put a function getData() { } declaration in the initScript it will run as soon as the app launches, that’s why we use this.getData):
this.getData = function() { return true | false; }
On the C# side:
private async void button5_Click(object sender, EventArgs e) { var result = await this.widget1.CallAsync("this.getData"); AlertBox.Show(result.ToString()); }
You can also add the [WebMethod] attribute to any function in C# and call that from JavaScript! Web methods are exposed automatically on top-level controls (Desktop, Page, Form) and in the main application static class (Program).
For Example:
JavaScript Side:
this.hello = function() { App.HelloWorld(); }
C# Side:
[WebMethod] public void HelloWorld() { AlertBox.Show("Hello, World!"); }
Check out these documents for more information and detail:
https://wisej.com/docs/2.0/html/JavaScript.htm
https://wisej.com/docs/2.1/html/JavaScriptObjectModel.htm
https://wisej.com/docs/2.0/html/T_Wisej_Web_Widget.htm (Call / Eval)
https://wisej.com/support/question/how-can-i-send-a-message-from-javascript-to-c
Best,
Levie
Levie (ITG)
Thank you.