Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static get openMessageBoxCommand() {
const textNode = document.createTextNode("This is a box opened using IModelApp.notifications.openMessageBox and using promise/then to process result.");
const message = document.createElement("div");
message.appendChild(textNode);
message.appendChild(this._longMessage);
return new CommandItemDef({
commandId: "openMessageBox",
iconSpec: "icon-info",
labelKey: "SampleApp:buttons.openMessageBox",
execute: () => {
// tslint:disable-next-line:no-floating-promises
IModelApp.notifications.openMessageBox(MessageBoxType.Ok,
message,
MessageBoxIconType.Information)
.then((value: MessageBoxValue) => { window.alert("Closing message box ... value is " + value); });
},
});
}
public static get setLengthFormatMetricCommand() {
return new CommandItemDef({
commandId: "setLengthFormatMetric",
iconSpec: "icon-info",
labelKey: "SampleApp:buttons.setLengthFormatMetric",
execute: () => {
IModelApp.quantityFormatter.useImperialFormats = false;
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, "Set Length Format to Metric"));
},
});
}
public static get warningMessageStickyCommand() {
return new CommandItemDef({
commandId: "warningMessage",
iconSpec: "icon-status-warning",
labelKey: "SampleApp:buttons.warningMessageBox",
execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, AppTools._warningStr, AppTools._detailMsg, OutputMessageType.Sticky)),
});
}
public static get item2() {
return new CommandItemDef({
commandId: "item2",
iconSpec: "icon-placeholder",
labelKey: "SampleApp:buttons.item2",
applicationData: { key: "value" },
execute: () => { AppUi.command2(); },
});
}
public static get errorMessageCommand() {
return new CommandItemDef({
commandId: "errorMessage",
iconSpec: "icon-status-rejected",
labelKey: "SampleApp:buttons.errorMessageBox",
execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error,
"This is an error message", this._longMessage,
OutputMessageType.Alert, OutputMessageAlert.Dialog)),
});
}
public static get informationMessageBoxCommand() {
return new CommandItemDef({
commandId: "informationMessage",
iconSpec: "icon-info",
labelKey: "SampleApp:buttons.informationMessageBox",
execute: () => ModalDialogManager.openDialog(AppTools._messageBox(MessageSeverity.Information, IModelApp.i18n.translate("SampleApp:buttons.informationMessageBox"))),
});
}
private get _reduceWidgetOpacity() {
return new CommandItemDef({
iconSpec: "icon-placeholder", labelKey: "SampleApp:buttons.reduceWidgetOpacity", execute: () => { UiFramework.setWidgetOpacity(0.50); },
});
}
public static get infoMessageCommand() {
return new CommandItemDef({
commandId: "infoMessage",
iconSpec: "icon-info",
labelKey: "SampleApp:buttons.informationMessageBox",
execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, "This is an info message", this._detailedMessage)),
});
}
public static get openMessageBoxCommand2() {
const textNode = document.createTextNode("This is a box opened using IModelApp.notifications.openMessageBox and using async/await to process result.");
const message = document.createElement("div");
message.appendChild(textNode);
message.appendChild(this._longMessage);
return new CommandItemDef({
commandId: "openMessageBox2",
iconSpec: "icon-status-warning",
labelKey: "SampleApp:buttons.openMessageBox",
execute: async () => {
const value: MessageBoxValue = await IModelApp.notifications.openMessageBox(MessageBoxType.YesNo,
message,
MessageBoxIconType.Warning);
window.alert("Closing message box ... value is " + value);
},
});
}
public static get errorMessageAlertCommand() {
return new CommandItemDef({
commandId: "errorMessage",
iconSpec: "icon-status-error",
labelKey: "SampleApp:buttons.errorMessageBox",
execute: () => IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, AppTools._errorStr, AppTools._detailMsg, OutputMessageType.Alert)),
});
}