提交 a8fc2bd9 编写于 作者: B Benjamin Pasero

fix #81763

上级 f52667b2
...@@ -43,10 +43,11 @@ export class DialogService implements IDialogService { ...@@ -43,10 +43,11 @@ export class DialogService implements IDialogService {
_serviceBrand: undefined; _serviceBrand: undefined;
private impl: IDialogService; private nativeImpl: IDialogService;
private customImpl: IDialogService;
constructor( constructor(
@IConfigurationService configurationService: IConfigurationService, @IConfigurationService private configurationService: IConfigurationService,
@ILogService logService: ILogService, @ILogService logService: ILogService,
@ILayoutService layoutService: ILayoutService, @ILayoutService layoutService: ILayoutService,
@IThemeService themeService: IThemeService, @IThemeService themeService: IThemeService,
...@@ -56,27 +57,32 @@ export class DialogService implements IDialogService { ...@@ -56,27 +57,32 @@ export class DialogService implements IDialogService {
@IClipboardService clipboardService: IClipboardService, @IClipboardService clipboardService: IClipboardService,
@IElectronService electronService: IElectronService @IElectronService electronService: IElectronService
) { ) {
this.customImpl = new HTMLDialogService(logService, layoutService, themeService, keybindingService, productService, clipboardService);
this.nativeImpl = new NativeDialogService(logService, sharedProcessService, electronService, clipboardService);
}
// Use HTML based dialogs private get useCustomDialog(): boolean {
if (configurationService.getValue('workbench.dialogs.customEnabled') === true) { return this.configurationService.getValue('workbench.dialogs.customEnabled') === true;
this.impl = new HTMLDialogService(logService, layoutService, themeService, keybindingService, productService, clipboardService);
}
// Electron dialog service
else {
this.impl = new NativeDialogService(logService, sharedProcessService, electronService, clipboardService);
}
} }
confirm(confirmation: IConfirmation): Promise<IConfirmationResult> { confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
return this.impl.confirm(confirmation); if (this.useCustomDialog) {
return this.customImpl.confirm(confirmation);
}
return this.nativeImpl.confirm(confirmation);
} }
show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions | undefined): Promise<IShowResult> { show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions | undefined): Promise<IShowResult> {
return this.impl.show(severity, message, buttons, options); if (this.useCustomDialog) {
return this.customImpl.show(severity, message, buttons, options);
}
return this.nativeImpl.show(severity, message, buttons, options);
} }
about(): Promise<void> { about(): Promise<void> {
return this.impl.about(); return this.nativeImpl.about();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册