当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript dialog.showErrorBox方法代码示例

本文整理汇总了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"]
      })
  );
};
开发者ID:nteract,项目名称:nteract,代码行数:25,代码来源:cli.ts

示例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');
    });
开发者ID:VS-work,项目名称:gapminder-offline,代码行数:9,代码来源:file-management.ts

示例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();
      });
开发者ID:AgileJoshua,项目名称:superpowers-app,代码行数:11,代码来源:main.ts

示例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);
      });
    }
  });
开发者ID:VS-work,项目名称:gapminder-offline,代码行数:47,代码来源:file-management.ts

示例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);
  }
};
开发者ID:Heeryong-Kang,项目名称:jamak,代码行数:22,代码来源:fileDialogs.ts

示例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);
开发者ID:Lugribossk,项目名称:electron-typescript,代码行数:31,代码来源:index.ts

示例7: showErrorMessage

function showErrorMessage (message: string) {
  app.focus()
  dialog.showErrorBox('Error launching app', message)
  process.exit(1)
}
开发者ID:electron,项目名称:electron,代码行数:5,代码来源:main.ts

示例8:

 socket.on('showErrorBox', (title, content) => {
     dialog.showErrorBox(title, content);
 });
开发者ID:E024,项目名称:Electron.NET,代码行数:3,代码来源:dialog.ts


注:本文中的electron.dialog.showErrorBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。