add Settings

This commit is contained in:
zhandouxiaojiji committed 2020-10-14 17:38:25 +08:00
1 parent 3ed022af37
commit a1adbe69c5
4 files changed
+162 -107

No files matched your search

+42 -30
View File
@@ -1,34 +1,46 @@
import { app, BrowserWindow, Menu, MenuItem, dialog, nativeTheme } from 'electron';
import {initMenu} from './AppMenu'
import AppMenu from './AppMenu'
import Settings from './Settings';
let mainWindow: BrowserWindow = null;
nativeTheme.themeSource = 'dark';
let createWindow = function () {
mainWindow = new BrowserWindow({
width: 1280,
height: 800,
webPreferences: {
nodeIntegration: true
}
// fullscreenable:false,
// maximizable:false
});
// mainWindow.webContents.openDevTools();
mainWindow.loadFile('index.html');
mainWindow.on('closed', function () {
mainWindow = null
});
initMenu(mainWindow);
export class MainProcess {
mainWindow: BrowserWindow;
appMenu: AppMenu;
settings: Settings;
constructor() {
nativeTheme.themeSource = 'dark';
app.on('ready', () => {
this.createWindow();
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (this.mainWindow === null) {
this.createWindow()
}
});
}
createWindow (){
this.settings = new Settings();
this.mainWindow = new BrowserWindow({
width: 1280,
height: 800,
webPreferences: {
nodeIntegration: true
}
// fullscreenable:false,
// maximizable:false
});
// mainWindow.webContents.openDevTools();
this.mainWindow.loadFile('index.html');
this.mainWindow.on('closed', function () {
this.mainWindow = null
});
this.appMenu = new AppMenu(this);
}
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
});
new MainProcess();