本文整理汇总了TypeScript中electron.dialog.showErrorBox方法的典型用法代码示例。如果您正苦于以下问题:TypeScript dialog.showErrorBox方法的具体用法?TypeScript dialog.showErrorBox怎么用?TypeScript dialog.showErrorBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.dialog
的用法示例。
在下文中一共展示了dialog.showErrorBox方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getStartCommand
export const installShellCommand = () => {
const directories = getStartCommand();
if (!directories) {
dialog.showErrorBox(
"nteract application not found.",
"Could not locate nteract executable."
);
return;
}
const [exe, rootDir, binDir] = directories;
const obs = installShellCommandsObservable(exe, rootDir, binDir);
obs.subscribe(
() => {},
err => dialog.showErrorBox("Could not write shell script.", err.message),
() =>
dialog.showMessageBox({
title: "Command installed.",
message: 'The shell command "nteract" is installed.',
detail: 'Get help with "nteract --help".',
buttons: ["OK"]
})
);
};
示例2:
fs.writeFile(fileName, JSON.stringify(tabsDescriptor, null, ' '), err => {
if (err) {
dialog.showErrorBox('File save error', err.message);
ga.error('Charts was NOT saved: ' + err.toString());
return;
}
ga.error('Charts successfully saved');
});
示例3: setupTrayOrDock
i18n.load([ "startup", "tray" ], () => {
if (dataPathErr != null) {
electron.dialog.showErrorBox(i18n.t("startup:failedToStart"), i18n.t(dataPathErr.key, dataPathErr.variables));
electron.app.quit();
process.exit(1);
return;
}
setupTrayOrDock();
setupMainWindow();
});
示例4: normalizeModelToOpen
fs.readFile(fileName, 'utf-8', (err, data) => {
if (err) {
dialog.showErrorBox('File reading error', err.message);
return;
}
const config = JSON.parse(data);
const brokenFileActions = [];
if (config.length) {
config.forEach(configItem => {
normalizeModelToOpen(configItem.model, currentDir, brokenFileActions);
});
async.waterfall(brokenFileActions, () => {
const newConfig = getConfigWithoutAbandonedData(config);
if (!_.isEmpty(newConfig)) {
sender.send('do-open-all-completed', newConfig);
}
setTimeout(() => {
sender.send('check-tab-by-default');
}, 500);
});
}
if (!config.length) {
normalizeModelToOpen(config, currentDir, brokenFileActions);
async.waterfall(brokenFileActions, () => {
const newConfigAsArray = getConfigWithoutAbandonedData(config);
if (!_.isEmpty(newConfigAsArray)) {
const newConfig = _.head(newConfigAsArray);
if (!_.isEmpty(newConfig)) {
sender.send('do-open-completed', {tab: newConfig, file: fileNameOnly});
}
}
setTimeout(() => {
sender.send('check-tab-by-default');
}, 500);
});
}
});
示例5: async
export const openSubtitleDialog = async (webContents: Electron.WebContents) => {
try {
const paths = dialog.showOpenDialog({
filters: subtitleFilters,
properties: ['openFile'],
});
if (!Array.isArray(paths) || paths.length === 0) {
return;
}
if (paths.length > 1) {
console.log('only support one file');
}
const subtitles = await readSubtitleFile(paths[0]);
webContents.send('open-subtitle', paths[0], subtitles);
} catch (error) {
dialog.showErrorBox('error', error);
}
};
示例6: findWidevine
import {dialog, app, BrowserWindow} from "electron";
import * as _ from "lodash";
import {findReact} from "./ExtensionFinder";
import {findFlash, findWidevine} from "./PluginFinder";
let isDevelopment = process.env.NODE_ENV !== "production";
let widevine = findWidevine(process);
if (!widevine.exists()) {
dialog.showErrorBox("", "Widevine CDM plugin not found. Is Chrome installed?");
}
widevine.addToCommandLine(app);
let flash = findFlash(process);
if (!flash.exists()) {
dialog.showErrorBox("", "Flash plugin not found. Is Chrome installed?");
}
flash.addToCommandLine(app);
app.on("ready", () => {
// Remove all extensions that were added in previous runs in case they are outdated or not needed.
_.forEach(BrowserWindow.getDevToolsExtensions(), extension => BrowserWindow.removeDevToolsExtension(extension.name));
if (isDevelopment) {
app.on("browser-window-created", (err, win) => {
win.webContents.toggleDevTools();
});
let react = findReact(process);
if (react.exists()) {
console.info("Loading React dev tools from", react.path);
示例7: showErrorMessage
function showErrorMessage (message: string) {
app.focus()
dialog.showErrorBox('Error launching app', message)
process.exit(1)
}
示例8:
socket.on('showErrorBox', (title, content) => {
dialog.showErrorBox(title, content);
});