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


TypeScript electron.dialog类代码示例

本文整理汇总了TypeScript中electron.dialog的典型用法代码示例。如果您正苦于以下问题:TypeScript dialog类的具体用法?TypeScript dialog怎么用?TypeScript dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了dialog类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: zipdir

    zipdir(`${WEB_PATH[process.platform]}`, {saveTo: fileName}, err => {
      if (err) {
        dialog.showMessageBox({message: 'This chart has NOT been exported.', buttons: ['OK']});
        ga.error('Export for Web was NOT completed: ' + err.toString());
        return;
      }

      dialog.showMessageBox({message: 'This chart has been exported.', buttons: ['OK']});
    });
开发者ID:VS-work,项目名称:gapminder-offline,代码行数:9,代码来源:file-management.ts

示例2:

    socket.on('showMessageBox', (browserWindow, options, guid) => {
        if ("id" in browserWindow) {
            var window = BrowserWindow.fromId(browserWindow.id);

            dialog.showMessageBox(window, options, (response, checkboxChecked) => {
                socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
            });
        } else {
            var message = browserWindow;
            let id = guid || options;
            dialog.showMessageBox(browserWindow, (response, checkboxChecked) => {
                socket.emit('showMessageBoxComplete' + id, [response, checkboxChecked]);
            });
        }
    });
开发者ID:E024,项目名称:Electron.NET,代码行数:15,代码来源:dialog.ts

示例3:

 () =>
   dialog.showMessageBox({
     title: "Command installed.",
     message: 'The shell command "nteract" is installed.',
     detail: 'Get help with "nteract --help".',
     buttons: ["OK"]
   })
开发者ID:nteract,项目名称:nteract,代码行数:7,代码来源:cli.ts

示例4:

const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
  dialog.showMessageBox({type: 'info', message: `Welcome Back, You arrived from: ${commandLine}`});
  // Someone tried to run a second instance, we should focus our window.
  if (mainWindow) {
    mainWindow.focus();
  }
});
开发者ID:ryan-nauman,项目名称:spotify-mini,代码行数:7,代码来源:background.ts

示例5: getLicense

 click: (menuItem, browserWindow) => {
   dialog.showMessageBox(browserWindow, {
     title: 'LICENSE',
     message: getLicense(),
     type: 'info',
   });
 },
开发者ID:Heeryong-Kang,项目名称:jamak,代码行数:7,代码来源:menu.ts

示例6: getVersion

 click: (menuItem, browserWindow) => {
   dialog.showMessageBox(browserWindow, {
     title: 'Info',
     message: getVersion(),
     type: 'info',
   });
 },
开发者ID:Heeryong-Kang,项目名称:jamak,代码行数:7,代码来源:menu.ts

示例7: function

 ipcMain.on("save", (event, arg) => {
   if (arg.pathToSave) {
     jsonfile.writeFile(arg.pathToSave, arg.spec, function(err) {
       if (!err) {
         event.sender.send("onSaveSuccess", {
           name: arg.name,
           path: arg.pathToSave
         });
       }
     });
   } else {
     dialog.showSaveDialog(
       {
         filters: [
           {
             name: "Json",
             extensions: ["json"]
           }
         ]
       },
       filename => {
         if (filename) {
           jsonfile.writeFile(filename, arg.spec, function(err) {
             if (!err) {
               event.sender.send("onSaveSuccess", {
                 name: arg.name,
                 path: filename
               });
             }
           });
         }
       }
     );
   }
 });
开发者ID:Raathigesh,项目名称:Atmo,代码行数:35,代码来源:messageHandler.ts

示例8: function

app.on('ready', function () {

    Menu.setApplicationMenu(null);

    let iconFile = process.platform === 'win32' ? 'tray.ico' : 'trayTemplate.png';
    tray = new Tray(path.normalize(`${app.getAppPath()}/icons/${iconFile}`));

    var windowOptions = Object.assign({}, {
      width: currentTheme.settings.BTWindowWidth,
      height: currentTheme.settings.BTWindowHeight,
      webPreferences: { preload:  path.resolve(`${__dirname}/preload.js`) }
    }, env.windowProperties)

    mainWindow = createWindow('main', windowOptions);

    mainWindow.loadURL(`file://${currentTheme.path}/${currentTheme.settings.BTMainFile}`);

    tray.setContextMenu(trayMenu);
    console.log('wtf');

    console.log(dialog.showMessageBox(mainWindow, {type: 'info', message: `Welcome Back, You arrived!`}));

    if (1 == 1 || env.name === 'development') {
        mainWindow.openDevTools();
    }
});
开发者ID:ryan-nauman,项目名称:spotify-mini,代码行数:26,代码来源:background.ts

示例9: Promise

  return new Promise((resolve, reject) => {
    const type = imageType(bytes);
    const options: SaveDialogOptions = {};

    const dateObj = new Date(Number(timestamp));
    if (dateObj.getTime() && !isNaN(dateObj.getTime())) {
      const momentObj = moment(dateObj);
      const filename = `Wire ${momentObj.format('YYYY-MM-DD')} at ${momentObj.format('H.mm.ss')}`;
      options.defaultPath = filename;
    }

    if (type && type.ext) {
      options.filters = [
        {
          extensions: [type.ext],
          name: 'Images',
        },
      ];
      options.defaultPath += `.${type.ext}`;
    }

    dialog.showSaveDialog(options, chosenPath => {
      if (chosenPath) {
        fs.writeFile(chosenPath, new Buffer(bytes.buffer), error => (error ? reject(error) : resolve()));
      }
    });
  });
开发者ID:wireapp,项目名称:wire-desktop,代码行数:27,代码来源:download.ts

示例10: loadFullMenu

 .then(kernelSpecs => {
   if (Object.keys(kernelSpecs).length !== 0) {
     store.dispatch(setKernelSpecs(kernelSpecs));
     const menu = loadFullMenu();
     Menu.setApplicationMenu(menu);
     const logo =
       process.platform === "win32" ? "logoWhite" : "logoTemplate";
     const trayImage = join(__dirname, "..", "static", `${logo}.png`);
     tray = new Tray(trayImage);
     const trayMenu = loadTrayMenu();
     tray.setContextMenu(trayMenu);
   } else {
     dialog.showMessageBox(
       {
         type: "warning",
         title: "No Kernels Installed",
         buttons: [],
         message: "No kernels are installed on your system.",
         detail:
           "No kernels are installed on your system so you will not be " +
           "able to execute code cells in any language. You can read about " +
           "installing kernels at " +
           "https://ipython.readthedocs.io/en/latest/install/kernel_install.html"
       },
       index => {
         if (index === 0) {
           app.quit();
         }
       }
     );
   }
 })
开发者ID:nteract,项目名称:nteract,代码行数:32,代码来源:index.ts


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