當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。