2021-03-09 14:59:24 +08:00
|
|
|
import { app, BrowserWindow } from 'electron'
|
2021-03-10 18:01:42 +08:00
|
|
|
import {join} from "path";
|
2021-11-16 15:52:09 +08:00
|
|
|
import './load-serialport'
|
2021-03-09 14:59:24 +08:00
|
|
|
|
2021-11-22 11:58:54 +08:00
|
|
|
function createWindow(page: String) {
|
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
|
fullscreen: true,
|
|
|
|
|
frame: false,
|
|
|
|
|
webPreferences: {
|
|
|
|
|
nodeIntegration: true,
|
|
|
|
|
preload: join(__dirname, 'preload.js')
|
2021-03-09 14:59:24 +08:00
|
|
|
}
|
2021-11-22 11:58:54 +08:00
|
|
|
})
|
2021-03-09 14:59:24 +08:00
|
|
|
|
2021-11-22 11:58:54 +08:00
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
|
win.loadURL(`http://localhost:3000/${page}.html`)
|
|
|
|
|
win.webContents.openDevTools()
|
|
|
|
|
} else {
|
|
|
|
|
win.loadFile(`dist/render/${page}.html`)
|
|
|
|
|
win.webContents.openDevTools()
|
|
|
|
|
}
|
2021-03-09 14:59:24 +08:00
|
|
|
}
|
|
|
|
|
|
2021-11-22 11:58:54 +08:00
|
|
|
function launch() {
|
2021-11-23 08:37:30 +08:00
|
|
|
// createWindow('satellite-data-monitor-platform')
|
2021-11-24 07:57:42 +08:00
|
|
|
createWindow('satellite-info-monitor-platform')
|
2021-11-23 12:57:57 +08:00
|
|
|
// createWindow('satellite-signal-monitor-platform')
|
2021-11-24 07:57:42 +08:00
|
|
|
// createWindow('satellite-state-monitor-platform')
|
2021-11-22 11:58:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.whenReady().then(launch)
|
2021-03-09 14:59:24 +08:00
|
|
|
|
|
|
|
|
app.on('window-all-closed', () => {
|
2021-11-22 11:58:54 +08:00
|
|
|
if (process.platform !== 'darwin') {
|
|
|
|
|
app.quit()
|
|
|
|
|
}
|
2021-03-09 14:59:24 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
app.on('activate', () => {
|
2021-11-22 11:58:54 +08:00
|
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
|
|
|
launch()
|
|
|
|
|
}
|
2021-03-09 14:59:24 +08:00
|
|
|
})
|