How to use the electron.dialog.showMessageBox function in electron

To help you get started, we’ve selected a few electron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oktapodia / coinwatch / app / main / AutoUpdater.js View on Github external
displayQuitAndInstallDialog() {
    dialog.showMessageBox(
      {
        type: 'question',
        buttons: ['Update & Restart', 'Cancel'],
        title: 'Update Available',
        cancelId: 99,
        message:
          'New version ready to install. Would you like to update CoinWatch now?',
      },
      response => {
        console.log(`Exit: ${response}`); // eslint-disable-line no-console

        if (response === 0) {
          this.setQuitState(true);
          autoUpdater.quitAndInstall();
        }
      },
github wavebox / waveboxapp / src / app / src / Services / WBRPCService / WBRPCWebContents.js View on Github external
_handleShowAsyncMessageDialog = (evt, options) => {
    if (!this[privConnected].has(evt.sender.id)) { return }
    const bw = BrowserWindow.fromWebContents(ElectronWebContents.rootWebContents(evt.sender))
    dialog.showMessageBox(bw, options, () => {
      /* no-op */
    })
  }
github hiddenswitch / Spellsource-Server / launcher / packages / meteor-electron / app / autoUpdater.js View on Github external
_askToApplyUpdate: function() {
    var self = this;

    dialog.showMessageBox({
      type: 'question',
      message: 'An update is available! Would you like to quit to install it? The application will then restart.',
      buttons: ['Ask me later', 'Quit and install']
    }, function(result) {
      if (result > 0) {
        // Emit the 'before-quit' event since the app won't quit otherwise
        // (https://app.asana.com/0/19141607276671/74169390751974) and the app won't:
        // https://github.com/atom/electron/issues/3837
        var event = {
          _defaultPrevented: false,
          isDefaultPrevented: function() {
            return this._defaultPrevented;
          },
          preventDefault: function() {
            this._defaultPrevented = true;
          }
github junwatu / pepefe / main.js View on Github external
ipcMain.on('HTMLData', (event, arg) => {

    if (timeReload) {
        let stringCommand = `document.getElementById("book-time-left").innerHTML="${arg}"`;
        browserWindow.webContents.executeJavaScript(stringCommand);
    } else {

        let data = site.processHTML(arg);
        if (data != undefined) {
            browserWindow.webContents.send('asyncMessage', site.processHTML(arg));
        } else {
            dialog.showMessageBox(browserWindow, { type: "info", message: "Something wrong with Packtpub site?" }, (index) => {
                if (index === 0) {
                    if (process.platform !== 'darwin') {
                        app.quit();
                    }
                }
            });
        }
    }
})
github bigclownlabs / bch-playground / index.js View on Github external
timer = setTimeout(()=>{

        dialog.showMessageBox(mainWindow, {
            type: "warning",
            buttons: ["Cancel", "Close without Saving"],
            title: "Warning",
            message: "Node-RED contains unsaved changes"
        }, (response)=>{
            if (response == 1) {
                mainWindow.send("iframe:node-red:visible", false);
                timer = setTimeout(()=>{mainWindow.close()}, 100);
            }
        });

    }, 1000);
  })
github zythum / weibotuchuang-electron / src / main.js View on Github external
function uploadFiles (files) {
  if (uploading) return
  const weiboCookies = storage.get('weibo_cookies')
  if (!weiboCookies) {
    app.focus()
    dialog.showMessageBox({
      type: 'info',
      message: '您还没有登陆围脖账号',
      detail: [
        '围脖图床是通过围脖来上传图片的,',
        '你需要通过使用您的围脖账号登陆来完成这这步操作'
      ].join('\n'),
      buttons: ['登陆微博', '取消'],
    }, res => {
      if (res !== 0) return
      weiboLogin((err, cookies) => {
        storage.set('weibo_cookies', cookies)
        updateMenu()
        doUpload(cookies, files)
      })
    })
  } else {
github dimitrov-adrian / RcloneTray / src / dialogs.js View on Github external
const confirmExit = function () {
  let choice = dialog.showMessageBox(null, {
    type: 'warning',
    buttons: ['Yes', 'No'],
    title: 'Quit RcloneTray',
    message: 'Are you sure you want to quit?',
    detail: 'There is active processes that will be terminated.'
  })
  return choice === 0
}
github signalapp / Signal-Desktop / ts / updater / macos.ts View on Github external
export async function showReadOnlyDialog(
  mainWindow: BrowserWindow,
  messages: MessagesType
): Promise {
  const options = {
    type: 'warning',
    buttons: [messages.ok.message],
    title: messages.cannotUpdate.message,
    message: messages.readOnlyVolume.message,
  };

  await dialog.showMessageBox(mainWindow, options);
}
github electron / electron / spec-main / api-dialog-spec.ts View on Github external
expect(() => {
        const w = new BrowserWindow()
        dialog.showMessageBox(w, { message: 'i am message' })
      }).to.not.throw()
    })
github withspectrum / spectrum / desktop / src / menu.js View on Github external
function showAbout() {
  dialog.showMessageBox({
    title: `About ${CONFIG.APP_NAME}`,
    message: `${CONFIG.APP_NAME} ${CONFIG.APP_VERSION}`,
    detail: `The community platform for the future.`,
    buttons: [],
    icon: CONFIG.ICON,
  });
}