Put a login button, H5 web angularjs in
$scope. The login=function () {
The window [' wpfToAngularObj] angularToWPF (' 123 ');
}
Wpf#
CefSharpSettings. LegacyJavascriptBindingEnabled=true;
WebView. JavascriptObjectRepository. Register (" boundAsync ", new WPFAngularObj (), isAsync: true, options: BindingOptions. DefaultBinder);
WebView. Address="http://localhost:8999/home.html#/login";
Public class WPFAngularObj
{
Public void angularToWPF (string MSG)
{
MessageBox. Show (MSG);
}
}
Has been unable to call to the method of WPF CefSharp tip always read a property 'angularToWPF of undefined find angularToWPF
CodePudding user response:
Life is simple, the code simply maybe you happier
WPF embedded a websocket server, and each do,
Don't want you to insert my code, I insert your code, then you will be very unhappy
CodePudding user response:
Don't want to find what the rigorous code, with baidu, with open a point, the code is not complicated, is mean that, at least nothing obviously wrong with
https://blog.csdn.net/glmushroom/article/details/107859484
CodePudding user response:
WPF procedures need to be installed in many industrial control, the socket is not desirable
CodePudding user response:
Since using CefSharp, the front is the front, the background is about the background, can put the websocket is regarded as a process of communication of two,
CodePudding user response:
WPF CefSharp contains a web page, several button control industrial control buttons on a page, so the WPF need modbus communication in industrial control, every time can't install to set aside the socket service IP.
CodePudding user response:
Your top, don't sink, online, etc
CodePudding user response:
Obviously no index to the window [' wpfToAngularObj] oh, registered name, with the index key,
CodePudding user response:
reference 5 floor tj_libo reply: WPF CefSharp contains a web page, several button control industrial control buttons on a page, so the WPF need modbus communication in industrial control, there is no time to set aside the socket installation service IP, The frontal 1. Is the websocket, not the socket 2. Is the machine loopback address 127.0.0.1, not the network address (this thing don't even walk, card should go directly to the pipeline or pci bus news) You don't have to struggle, the article is 2020, not 5 or 6 years ago, did you see the things you don't have, use, Google now do automated web test two tool, Google is actually the websocket and headless protocol control, or think you script and back into each other, play test automation's brother also shall not work overtime everyday CodePudding user response:
You only need to open the service of the provisions of the port number, and you need to exchange data communications protocol format is Now you don't need to pipe aue, angrljs there, they can get, you're just the cef, according to , of course, you can use Cef bearing, the local file system, it put a lot of situations are we directly use owin self direct a built-in local web host, so what your asp MVC webapi can directly use (of course now is owin + asp.net MVC core) so you don't actually need to focus on WPF part, that is joke only coat, he is essentially a web development CodePudding user response:
The stuff of nodejs development is the same, that is to use what winform, WPF, qt operation page oh, They are developing a web site, use NPM start a built-in local website, with cef show CodePudding user response:
TypeError: window. SayChart. SayChart is not a function Js: $scope. The login=function () { //the window. The external. ShowMsg (" 123123123 "); The window [' sayChart] sayChart (" 11123123123 "); }; WPF: WebView. JavascriptObjectRepository. Register (" sayChart ", new CallbackObjectForJs (), isAsync: false, options: BindingOptions. DefaultBinder); WebView. Address="http://localhost:8999/home.html#/login"; Public class CallbackObjectForJs { Public string name=""; //method will have a return value Public object getChartData (string table) { Return new List {" a ", "b", "c"}; } //method can not return value Public void sayChart (string STR) { System. Windows. MessageBox. Show (STR); } } Still unable to call to WPF method, CodePudding user response:
My colleague just contact angularJS, let them get angularJS websocket, now some difficulty, overall architecture program is h5 + angularJS, need in the industrial computer and open the page through the modbus control industrial PC in the colorful lights, so using WPF + CefSharp CodePudding user response:
Js set breakpoints watch window [' sayChart] has always been undefined, WPF function cannot access to CodePudding user response:
The h5 development can use c # instead of js, Microsoft has been officially released. The net 5, you can rest assured use webassembly,. With the.net framework and c # web standard with blazor (or you can consult the blazor compiled into a DLL can be issued via nuget page controls original source code) to design and binding template, Note that no js, CodePudding user response:
Using c # and some knowledge of HTML + CSS, you can use the knowledge in the net, such as linq and so on, traditional and ClientWebSocket etc. Net 5 new standard library, CodePudding user response:
reference tj_libo reply: 3/f WPF procedures need to be installed on more Taiwan industrial socket undesirable Web and WCF client, you should design a "server" software, web page through the websocket server, WPF can through the TCP server, and the control process server as the core, CodePudding user response:
reference 13 floor tj_libo reply: js set breakpoints watch window [' sayChart] has been the undefined, WPF function cannot access to So try: Window. SayChart. SayChart (" 11123123123 ");