Skip to content

Commit 86aae5e

Browse files
author
yaofeng
committed
finish pack check
1 parent fcbefa6 commit 86aae5e

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

ElectronNET.CLI/ElectronNET.CLI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1010
<PackageOutputPath>..\artifacts</PackageOutputPath>
1111
<PackageId>ElectronNET.CLI</PackageId>
12-
<Version>1.0.4.1</Version>
12+
<Version>1.0.4.2</Version>
1313
<Authors>Gregor Biswanger, Robert Muehsig</Authors>
1414
<Product>Electron.NET</Product>
1515
<Company />

ElectronNET.Host/main.js

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
const { app } = require('electron');
1+
const { app } = require('electron');
22
// yf add
3-
const { BrowserWindow } = require('electron')
3+
const { BrowserWindow, dialog, shell } = require('electron')
44

55
const fs = require('fs');
66
const path = require('path');
77
const process = require('child_process').spawn;
88
const portfinder = require('detect-port');
99
let io, browserWindows, ipc, apiProcess, loadURL;
10-
let appApi, menu, dialog, notification, tray, webContents;
11-
let globalShortcut, shell, screen, clipboard;
10+
let appApi, menu, dialogApi, notification, tray, webContents;
11+
let globalShortcut, shellApi, screen, clipboard;
1212

1313
// yf add
1414
let loadingWindow;
1515
let mainWindowId;
16+
let countDownInterval;
1617

1718
// yf add
1819
const manifestJsonFile = require("./bin/electron.manifest.json");
@@ -52,12 +53,12 @@ function startSocketApiBridge(port) {
5253
browserWindows = require('./api/browserWindows')(socket);
5354
ipc = require('./api/ipc')(socket);
5455
menu = require('./api/menu')(socket);
55-
dialog = require('./api/dialog')(socket);
56+
dialogApi = require('./api/dialog')(socket);
5657
notification = require('./api/notification')(socket);
5758
tray = require('./api/tray')(socket);
5859
webContents = require('./api/webContents')(socket);
5960
globalShortcut = require('./api/globalShortcut')(socket);
60-
shell = require('./api/shell')(socket);
61+
shellApi = require('./api/shell')(socket);
6162
screen = require('./api/screen')(socket);
6263
clipboard = require('./api/clipboard')(socket);
6364
});
@@ -114,13 +115,45 @@ function startLoadingWindow() {
114115
loadingWindow.loadURL(loadingUrl);
115116
loadingWindow.once('ready-to-show', () => {
116117
loadingWindow.show()
118+
119+
// 激活倒计时
120+
activeCountDowInterval(manifestJsonFile)
117121
})
118122
loadingWindow.on('closed', () => {
119123
loadingWindow = null
124+
125+
clearInterval(countDownInterval)
120126
})
121127
}
122128
}
123129

130+
function activeCountDowInterval(manifestJsonFile) {
131+
if (!manifestJsonFile.timeout || !manifestJsonFile.timeout.limit)
132+
return
133+
134+
let limitSecond = manifestJsonFile.timeout.limit
135+
let currentSecond = 0;
136+
countDownInterval = setInterval(() => {
137+
currentSecond++;
138+
if (currentSecond < limitSecond)
139+
return;
140+
141+
clearInterval(countDownInterval);
142+
143+
dialog.showMessageBox(loadingWindow, {
144+
type: 'error',
145+
buttons: ["前往安装"],
146+
title: '文件缺失提示',
147+
message: '计算机缺少组件无法启动该程序,点击前往安装组件后重试',
148+
}, (res, isChecked) => {
149+
if (manifestJsonFile.timeout.help)
150+
shell.openExternal(manifestJsonFile.timeout.help)
151+
app.quit();
152+
});
153+
154+
}, 1000)
155+
}
156+
124157
//app.on('activate', () => {
125158
// On macOS it's common to re-create a window in the app when the
126159
// dock icon is clicked and there are no other windows open.

0 commit comments

Comments
 (0)