简体   繁体   English

从C#Windows Phone应用程序调用Javascript-这是一个好方法吗?

[英]Calling Javascript from C# Windows Phone App - Is it a good method?

I'm looking into backend services for developing a cross-platform communication app (target devices are iOS, Android, and Windows Phone). 我正在研究用于开发跨平台通信应用程序(目标设备是iOS,Android和Windows Phone)的后端服务。 Currently, I'm looking at Sinch . 目前,我正在寻找Sinch

I'm starting prototype dev on Android for now, and Sinch has an Android-native SDK. 我现在开始在Android上进行原型开发,Sinch有一个Android原生SDK。 However, it does not have a WP-native SDK. 但是,它没有WP-native SDK。

Sinch does have a Javascript SDK. Sinch 确实有一个Javascript SDK。

I know that you can write Javascript + HTML apps for Windows Phone right out of the box. 我知道您可以直接为Windows Phone编写Javascript + HTML应用程序。 I have developed for WP before but only in C#, and I like the features available and I believe (correct me if I'm wrong) that Javascript + HTML runs as a web-browser-based app rather than natively like C#. 我以前是为WP开发的,但仅在C#中开发的,我喜欢可用的功能,并且我相信(如果我错了,请纠正我)Javascript + HTML可以作为基于Web浏览器的应用程序运行,而不是像C#那样本机运行。

So, looking into the future, it seems that I may have trouble porting my app to Windows Phone (which is my favorite platform). 因此,展望未来,似乎我可能无法将应用程序移植到Windows Phone(这是我最喜欢的平台)上。

I have looked into calling Javascript code from C#. 我已经研究过从C#调用Javascript代码。 From what I have read, it seems that you can use a Browser object to evaluate Javascript code from a C# app. 根据我的阅读,看来您可以使用Browser对象来评估来自C#应用程序的Javascript代码。

My question is this: would it be feasible to write the majority of my Windows Phone app in C# and then use the Sinch Javascript library when the time comes to send messages? 我的问题是这样的:是否可以用C#编写大部分Windows Phone应用程序,然后在需要发送消息时使用Sinch Javascript库? Would this cause major stability problems? 这会引起重大的稳定性问题吗?

I'd rather not have a full-screen web browser app. 我宁愿没有全屏Web浏览器应用程序。

Is it possible to hide the web browser object and simply use it to evaluate Javascript code? 是否可以隐藏Web浏览器对象并仅使用它来评估Javascript代码? Or is there any easier way to obtain this interop? 还是有任何更简单的方法来获取此互操作?

Thanks for any responses! 感谢您的任何回复!

EDIT: Let me know if you think it may be worth just going with a full out Javascript+HTML implementation of my app and forget about the C#. 编辑:请让我知道,如果您认为使用我的应用程序的完整Javascript + HTML实现可能值得而忘了C#。

如果您正在使用消息传递,则是。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM