本文整理匯總了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);
});