From 4e6d8e509dcf407d488faa64ef03d2ff8f8e2b4d Mon Sep 17 00:00:00 2001 From: dinglili Date: Mon, 5 Aug 2024 17:28:23 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=20=E8=B7=B3=E8=BF=87=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I23647786339d3b1f32211cb90186ea534ac20763 --- src/vs/code/electron-main/app.ts | 2 +- .../deploy/deployWindowMain.ts | 12 ++--- .../issue/electron-main/deployMainService.ts | 53 ++++++++++--------- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index af61e52c..a7ff00e9 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -1373,7 +1373,7 @@ export class CodeApplication extends Disposable { private async openDeploylWindow(accessor: ServicesAccessor): Promise { const DeployMainService = accessor.get(IDeployMainService); await new Promise((resolve, reject) => { - DeployMainService.openDeployWindow().then(() => { + DeployMainService.openDeployWindow(true).then(() => { resolve(void 0); }).catch((error) => { console.log(error); diff --git a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts index 99deddf6..2cdf4dc8 100644 --- a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts +++ b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts @@ -457,8 +457,8 @@ class deployWindow { if (this.notNowRadio && this.notNowRadio instanceof HTMLInputElement && this.notNowRadio.checked) { this.justDownLoadTabArrayIndex = 0; this.localInstallTabArrayIndex = 0; - console.log('renderer send kylinide.installWizard.skipWizard'); - ipcRenderer.send('kylinide.installWizard.skipWizard'); + // console.log('renderer send kylinide.installWizard.skipWizard'); + ipcRenderer.send('kylinide.installWizard.closeWizard', { type: "skip" }); } else if (this.onlineInstallRadio && this.onlineInstallRadio instanceof HTMLInputElement && this.onlineInstallRadio.checked) { this.justDownLoadTabArrayIndex = 0; this.localInstallTabArrayIndex = 0; @@ -773,10 +773,10 @@ class deployWindow { ipcRenderer.send('kylinide.installWizard.helpLink', { type: "helpLink" }) }); - document.getElementById('skipAll')?.addEventListener('click', () => { - console.log("render send kylinide.installWizard.skipWizard"); - ipcRenderer.send('kylinide.installWizard.skipWizard'); - }); + // document.getElementById('skipAll')?.addEventListener('click', () => { + // console.log("render send kylinide.installWizard.skipWizard"); + // ipcRenderer.send('kylinide.installWizard.skipWizard'); + // }); this.prevBtn!.addEventListener('click', () => { console.log('click prevStep'); diff --git a/src/vs/platform/issue/electron-main/deployMainService.ts b/src/vs/platform/issue/electron-main/deployMainService.ts index eea571ca..df85148d 100644 --- a/src/vs/platform/issue/electron-main/deployMainService.ts +++ b/src/vs/platform/issue/electron-main/deployMainService.ts @@ -136,9 +136,6 @@ export class DeployMainService implements IDeployMainService { this.loggerSoft = this.loggerMainService.createLogger(URI.file(this.installConfig + "/log/softdetail.log")); this.removeListeners(); this.registerListeners(); - this.deployWindowrParentWindow?.on('close', () => { - this.deployWindowrParentWindow = null; - }) } reset() { this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0, osrelease: "", supportList: [] }; @@ -201,14 +198,18 @@ export class DeployMainService implements IDeployMainService { this.logger.info("最小化窗口"); this.minWindow(); }; - listenerCloseWindow = (event: IpcMainEvent) => { - //删除新下载但是没被使用的配置文件 - if (this.updateConfigDir) { - if (this.selectObject.updateFlag == false) - if (fs.existsSync(this.updateConfigDir)) - fs.rmdirSync(this.updateConfigDir, { recursive: true }); + listenerCloseWindow = (event: IpcMainEvent, msg: any) => { + if (msg.type === 'skip') { + this.logger.info("跳过配置"); + } + if (msg.type === "close") { + //删除新下载但是没被使用的配置文件 + if (this.updateConfigDir) { + if (this.selectObject.updateFlag == false) + if (fs.existsSync(this.updateConfigDir)) + fs.rmdirSync(this.updateConfigDir, { recursive: true }); + } } - this.closeWindow(); }; @@ -1233,23 +1234,25 @@ export class DeployMainService implements IDeployMainService { this.DeployWindow.on('close', () => { this.logger.info("关闭窗口"); this.DeployWindow = null; - validatedIpcMain.removeListener('kylinide.installWizard.skipWizard', listenerSkipWizard - ); - // validatedIpcMain.removeListener('kylinide.installWizard.init', listenerInit); - DeployDisposables.dispose(); - if (flag) { - // 第一次打开时,关闭窗口,继续 - resolve(void 0); + try { + DeployDisposables.dispose(); + } catch { + this.logger.error("deployDisposables.dispose() catch"); } + + resolve(void 0); }); - const listenerSkipWizard = async (event: IpcMainEvent) => { - this.logger.info("跳过配置"); - if (this.DeployWindow && this.DeployWindow != undefined) { - this.DeployWindow.close(); - } - } - validatedIpcMain.on('kylinide.installWizard.skipWizard', listenerSkipWizard - ); + this.deployWindowrParentWindow?.on('close', () => { + this.deployWindowrParentWindow = null; + }) + // const listenerSkipWizard = async (event: IpcMainEvent) => { + // this.logger.info("跳过配置"); + // if (this.DeployWindow && this.DeployWindow != undefined) { + // this.DeployWindow.close(); + // } + // } + // validatedIpcMain.on('kylinide.installWizard.skipWizard', listenerSkipWizard + // ); } if (this.DeployWindow) { this.focusWindow(this.DeployWindow);