2018-02-08 19:10:13 +01:00
|
|
|
import { BrowserWindow } from 'electron';
|
2018-01-16 21:58:17 +01:00
|
|
|
|
2018-02-08 19:10:13 +01:00
|
|
|
import { MenuMain } from './main/menu.main';
|
|
|
|
import { MessagingMain } from './main/messaging.main';
|
2018-02-11 05:24:22 +01:00
|
|
|
import { PowerMonitorMain } from './main/powerMonitor.main';
|
2018-02-12 22:07:14 +01:00
|
|
|
import { UpdaterMain } from './main/updater.main';
|
2018-02-08 19:10:13 +01:00
|
|
|
import { WindowMain } from './main/window.main';
|
2018-01-23 19:59:01 +01:00
|
|
|
|
2018-02-11 05:24:22 +01:00
|
|
|
import { DesktopMainMessagingService } from './services/desktopMainMessaging.service';
|
|
|
|
import { DesktopStorageService } from './services/desktopStorage.service';
|
2018-01-24 22:02:18 +01:00
|
|
|
import { I18nService } from './services/i18n.service';
|
2018-02-08 18:24:17 +01:00
|
|
|
|
2018-01-16 23:30:57 +01:00
|
|
|
const args = process.argv.slice(1);
|
2018-01-17 21:42:28 +01:00
|
|
|
const watch = args.some((val) => val === '--watch');
|
|
|
|
const dev = args.some((val) => val === '--dev');
|
2018-01-16 20:48:34 +01:00
|
|
|
|
2018-01-17 21:42:28 +01:00
|
|
|
if (watch) {
|
2018-02-10 21:30:42 +01:00
|
|
|
// tslint:disable-next-line
|
2018-01-16 23:30:57 +01:00
|
|
|
require('electron-reload')(__dirname, {});
|
|
|
|
}
|
|
|
|
|
2018-02-08 21:58:47 +01:00
|
|
|
const windowMain = new WindowMain(dev);
|
2018-02-09 21:49:00 +01:00
|
|
|
const messagingMain = new MessagingMain(windowMain);
|
2018-02-11 05:24:22 +01:00
|
|
|
|
|
|
|
const i18nService = new I18nService('en', './locales/');
|
|
|
|
const storageService = new DesktopStorageService();
|
|
|
|
const messagingService = new DesktopMainMessagingService(windowMain, messagingMain);
|
|
|
|
|
2018-02-13 18:59:24 +01:00
|
|
|
const updaterMain = new UpdaterMain(windowMain, i18nService);
|
2018-02-12 22:07:14 +01:00
|
|
|
const menuMain = new MenuMain(windowMain, updaterMain, i18nService, messagingService);
|
2018-02-11 05:24:22 +01:00
|
|
|
const powerMonitorMain = new PowerMonitorMain(storageService, messagingService);
|
2018-01-16 23:30:57 +01:00
|
|
|
|
2018-02-14 04:33:01 +01:00
|
|
|
windowMain.init().then(async () => {
|
2018-02-10 17:58:14 +01:00
|
|
|
messagingMain.init();
|
2018-02-14 04:33:01 +01:00
|
|
|
await i18nService.init();
|
2018-02-09 06:21:00 +01:00
|
|
|
menuMain.init();
|
2018-02-11 05:24:22 +01:00
|
|
|
powerMonitorMain.init();
|
2018-02-14 04:33:01 +01:00
|
|
|
await updaterMain.init();
|
2018-02-09 06:21:00 +01:00
|
|
|
}, (e: any) => {
|
2018-02-10 21:30:42 +01:00
|
|
|
// tslint:disable-next-line
|
2018-02-09 06:21:00 +01:00
|
|
|
console.log(e);
|
|
|
|
});
|