提交 7252fd20 编写于 作者: I isidor

dialogService: allow checkboxes for show

上级 87b65b90
...@@ -97,7 +97,9 @@ export class DialogService implements IDialogService { ...@@ -97,7 +97,9 @@ export class DialogService implements IDialogService {
EventHelper.stop(event, true); EventHelper.stop(event, true);
} }
} }
} },
checkboxLabel: options && options.checkbox ? options.checkbox.label : undefined,
checkboxChecked: options && options.checkbox ? options.checkbox.checked : undefined
}); });
dialogDisposables.add(dialog); dialogDisposables.add(dialog);
...@@ -107,7 +109,8 @@ export class DialogService implements IDialogService { ...@@ -107,7 +109,8 @@ export class DialogService implements IDialogService {
dialogDisposables.dispose(); dialogDisposables.dispose();
return { return {
choice: result.button choice: result.button,
checkboxChecked: result.checkboxChecked
}; };
} }
} }
...@@ -143,6 +143,10 @@ export const IDialogService = createDecorator<IDialogService>('dialogService'); ...@@ -143,6 +143,10 @@ export const IDialogService = createDecorator<IDialogService>('dialogService');
export interface IDialogOptions { export interface IDialogOptions {
cancelId?: number; cancelId?: number;
detail?: string; detail?: string;
checkbox?: {
label: string;
checked?: boolean;
};
} }
/** /**
......
...@@ -137,11 +137,13 @@ class NativeDialogService implements IDialogService { ...@@ -137,11 +137,13 @@ class NativeDialogService implements IDialogService {
buttons, buttons,
type: (severity === Severity.Info) ? 'question' : (severity === Severity.Error) ? 'error' : (severity === Severity.Warning) ? 'warning' : 'none', type: (severity === Severity.Info) ? 'question' : (severity === Severity.Error) ? 'error' : (severity === Severity.Warning) ? 'warning' : 'none',
cancelId: dialogOptions ? dialogOptions.cancelId : undefined, cancelId: dialogOptions ? dialogOptions.cancelId : undefined,
detail: dialogOptions ? dialogOptions.detail : undefined detail: dialogOptions ? dialogOptions.detail : undefined,
checkboxLabel: dialogOptions && dialogOptions.checkbox ? dialogOptions.checkbox.label : undefined,
checkboxChecked: dialogOptions && dialogOptions.checkbox ? dialogOptions.checkbox.checked : undefined
}); });
const result = await this.windowService.showMessageBox(options); const result = await this.windowService.showMessageBox(options);
return { choice: buttonIndexMap[result.button] }; return { choice: buttonIndexMap[result.button], checkboxChecked: result.checkboxChecked };
} }
private massageMessageBoxOptions(options: Electron.MessageBoxOptions): IMassagedMessageBoxOptions { private massageMessageBoxOptions(options: Electron.MessageBoxOptions): IMassagedMessageBoxOptions {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册