From df166f3dd0bdbca934eef660d6ab6c672cf83b05 Mon Sep 17 00:00:00 2001 From: MathieuG-P Date: Wed, 28 Dec 2022 20:39:11 +0100 Subject: [PATCH] fix get main window from windows service --- src/main/services/bs-installer.service.ts | 5 ++++- src/main/services/window-manager.service.ts | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/services/bs-installer.service.ts b/src/main/services/bs-installer.service.ts index 06971716..6c412ac3 100644 --- a/src/main/services/bs-installer.service.ts +++ b/src/main/services/bs-installer.service.ts @@ -8,6 +8,7 @@ import { InstallationLocationService } from "./installation-location.service"; import { ctrlc } from "ctrlc-windows"; import { BSLocalVersionService } from "./bs-local-version.service"; import isOnline from 'is-online'; +import { WindowManagerService } from "./window-manager.service"; export class BSInstallerService{ @@ -16,6 +17,7 @@ export class BSInstallerService{ private readonly utils: UtilsService; private readonly installLocationService: InstallationLocationService; private readonly localVersionService: BSLocalVersionService; + private readonly windows: WindowManagerService; private downloadProcess: ChildProcessWithoutNullStreams; @@ -23,8 +25,9 @@ export class BSInstallerService{ this.utils = UtilsService.getInstance(); this.installLocationService = InstallationLocationService.getInstance(); this.localVersionService = BSLocalVersionService.getInstance(); + this.windows = WindowManagerService.getInstance(); - this.utils.getMainWindow().on("close", () => { + this.windows.getWindows("index.html").on("close", () => { this.killDownloadProcess(); }); } diff --git a/src/main/services/window-manager.service.ts b/src/main/services/window-manager.service.ts index 1f26bb05..e81a3ec4 100644 --- a/src/main/services/window-manager.service.ts +++ b/src/main/services/window-manager.service.ts @@ -75,4 +75,8 @@ export class WindowManagerService{ }); } + public getWindows(window: AppWindow): BrowserWindow{ + return this.windows.get(window); + } + } \ No newline at end of file