初始版本
This commit is contained in:
59
win.app/main.aardio
Normal file
59
win.app/main.aardio
Normal file
@@ -0,0 +1,59 @@
|
||||
import win.ui;
|
||||
/*DSG{{*/
|
||||
mainForm = win.form(text="aardio 工程";right=759;bottom=531;max=false)
|
||||
mainForm.add()
|
||||
/*}}*/
|
||||
|
||||
import web.view.7;
|
||||
var wb = web.view(mainForm);
|
||||
|
||||
|
||||
|
||||
import wsock.tcp.asynHttpServer;
|
||||
var httpServer = wsock.tcp.asynHttpServer();
|
||||
|
||||
//这里可以指定 IP 和端口,不指定则自动分配空闲端口
|
||||
httpServer.start("127.0.0.1");
|
||||
|
||||
//服务端 aardio 支持模板语法: doc://language-reference/templating/syntax.md
|
||||
var url = httpServer.getUrl("/web/firmware_upgrade.html"); //参数支持 aardio 工程嵌入资源目录路径
|
||||
|
||||
/*
|
||||
import web.view;
|
||||
var wb = web.view(winform);
|
||||
*/
|
||||
|
||||
//用浏览器组件打开网页试试
|
||||
wb.go(url);
|
||||
|
||||
|
||||
import fsys.update.simpleMain;
|
||||
if( fsys.update.simpleMain(
|
||||
"aardio 工程",
|
||||
"https://list.020824.xyz/d/Pics/FW/demo/v1/.update-files/version.txt?sign=SVvWq8CBYyAObIvQ9yC2yNC4XMik-QX2zMFs8UvCeGs=:0", /*网址也可以改用目录名,并使用服务端代码动态返回version.txt*/
|
||||
"/download/update-files", /*绿色软件建议改为 io.appData("/软件厂商名/软件名字/update-files") */
|
||||
function(version,description,status){
|
||||
import console
|
||||
console.log(version,description,status)
|
||||
/*
|
||||
version参数包含最新版本号,
|
||||
description包含最新版本更新说明,
|
||||
status参数值见下面的列表:
|
||||
"ready": 下载已完成并准备更新,
|
||||
"updated": 已更新到新版本并准备启动新版
|
||||
"complete": 当前已更新并已启动新版本主程序,所有操作已完成
|
||||
"latest": 已经是最新版不需要更新
|
||||
"failed": 出错了,description参数为错误信息
|
||||
|
||||
这个回调函数不是必须的,
|
||||
在此检测更新代码之前或之后都可以在界面线程调用
|
||||
fsys.update.simpleMain.onStatusChanged 订阅更新状态变更信息。
|
||||
该认阅回调函数的参数与上面的回调参数相同。
|
||||
*/
|
||||
} )){
|
||||
return 0; //必须退出 main.aardio 以启动更新
|
||||
}
|
||||
|
||||
|
||||
mainForm.show();
|
||||
win.loopMessage();
|
Reference in New Issue
Block a user