mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { ipcMain } from "electron";
|
|
import { WindowManagerService } from "../services/window-manager.service";
|
|
import { IpcRequest } from "shared/models/ipc";
|
|
import { AppWindow } from "shared/models/window-manager/app-window.model";
|
|
import { BSLauncherService } from "../services/bs-launcher.service";
|
|
|
|
const launcher = BSLauncherService.getInstance();
|
|
|
|
ipcMain.on("open-window-then-close-all", async (event, request: IpcRequest<AppWindow>) => {
|
|
const windowManager = WindowManagerService.getInstance();
|
|
|
|
windowManager.openWindow(request.args).then(window => {
|
|
windowManager.closeAllWindows(request.args);
|
|
});
|
|
});
|
|
|
|
ipcMain.on("close-all-windows", async (event, request: IpcRequest<AppWindow>) => {
|
|
await launcher.restoreSteamVR();
|
|
const windowManager = WindowManagerService.getInstance();
|
|
windowManager.closeAllWindows(request.args);
|
|
});
|
|
|
|
ipcMain.on("close-windows", async (event, request: IpcRequest<AppWindow[]>) => {
|
|
await launcher.restoreSteamVR();
|
|
const windowManager = WindowManagerService.getInstance();
|
|
windowManager.close(...request.args);
|
|
}); |