简体   繁体   English

创建使用不同语言的混合桌面和Web应用程序

[英]Create hybrid desktop and web application with different languages

I want to create an app to estimate engineering costs: lots of tables, forms, a sidebar with a tree structure and so on. 我想创建一个用于估算工程成本的应用程序:大量表,表格,带有树形结构的侧边栏等。 You can access a database in the cloud and create table structures according to records in the database. 您可以访问云中的数据库并根据数据库中的记录创建表结构。

Naturally that would be a website, however, if the user does not always have an access to the Internet, he/she can download a copy of that database (precisely, a copy of the current version of the database), so that it would be possible to get data from it and work locally. 自然地,那将是一个网站,但是,如果用户并不总是可以访问Internet,则他/她可以下载该数据库的副本(精确地是该数据库当前版本的副本),以便可以从中获取数据并在本地工作。 That is why an offline desktop app is needed. 这就是为什么需要一个脱机桌面应用程序的原因。

Would it be possible to develop such a hybrid application without first creating a web app and then doing the same with a desktop app? 是否有可能在不首先创建Web应用程序然后对台式机应用程序执行相同操作的情况下开发此类混合应用程序?

Previously i have looked into JavaFX, but we saw that it's too difficult to create a website out of that. 以前,我研究过JavaFX,但我们发现用它创建网站太困难了。 Then we saw Electron, but i'm not sure if it is the right choice, because it seams that Electron is only used for desktop. 然后我们看到了Electron,但是我不确定这是否是正确的选择,因为它似乎表明Electron仅用于桌面。

I'm lost as to why you feel you need a website/desktop hybrid. 我不知道为什么您会觉得自己需要一个网站/桌面混合平台。 There are many APIs available to let you access a cloud database. 有许多可用的API使您可以访问云数据库。 All you have to do is find an API with web hooks, or APIs that specifically target the database type you are using (sql, mongo, or whatever). 您所要做的就是找到带有Web挂钩的API,或专门针对您正在使用的数据库类型(SQL,Mongo或其他)的API。 Then just cache a local copy once you've pulled down the database. 然后,一旦关闭数据库,只需缓存本地副本。

Work on the copy then push back to the database when they save, or try to do a push/pull every 5 minutes or something. 处理副本,然后在保存时将其推回数据库,或者尝试每5分钟执行一次推/拉操作。

You can make a HTML page, which would: 您可以制作一个HTML页面,该页面将:

  • Use AJAX calls if connected 使用AJAX通话(如果已连接)
  • Add relative <script> tag, thinking that HTML file lies in a folder on PC, and that script is somewhere nearbly. 添加相对的<script>标记,认为HTML文件位于PC上的文件夹中,并且该脚本几乎在某个地方。

In both cases, user will get same results. 在这两种情况下,用户将获得相同的结果。 Downloads are: 下载是:

  • HTML file with inline script 带有内嵌脚本的HTML文件
  • JS file with database 带有数据库的JS文件

or 要么

  • zipped folder with HTML, database JS files and all scripts, images, css, etc. requred for HTML file to show properly. 包含HTML,数据库JS文件以及所有脚本,图像,css等的压缩文件夹,要求HTML文件正确显示。

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

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