• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript electron.remote.dialog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: chooseFileOrDirWithDialog

 function chooseFileOrDirWithDialog() {
     const filters = [
         {
             name: 'Markdown',
             extensions: config.file_ext.markdown,
         },
         {
             name: 'HTML',
             extensions: config.file_ext.html,
         },
     ];
     const properties = ['openFile'] as ('openFile' | 'openDirectory' | 'multiSelections' | 'createDirectory')[];
     if (on_darwin) {
         // Note:
         // On Windows and Linux an open dialog can not be both a file selector
         // and a directory selector, so if you set properties to
         // ['openFile', 'openDirectory'] on these platforms, a directory
         // selector will be shown.
         properties.push('openDirectory');
     }
     const paths = remote.dialog.showOpenDialog({
         title: 'Choose file or directory to watch',
         defaultPath: getDialogDefaultPath(),
         filters,
         properties,
     });
     if (!paths || paths.length === 0) {
         return '';
     }
     return paths[0];
 }
开发者ID:WondermSwift,项目名称:Shiba,代码行数:31,代码来源:index.ts


示例2: function

$('body').on('click', '.button#load-template', function(event) {
  dialog.showOpenDialog(
  {
    title: 'Open New Email Template',
    filters: [
      {name: 'Templates', extensions: ['html']},
      {name: 'All Files', extensions: ['*']}
    ]
  }, function(fileNames: string[]) {
    if (fileNames !== undefined) {
      storage.get('templates', function(error, templates) {
        if (_.isEmpty(templates)) {
          templates = [];
        }
        if (! _.contains(templates, fileNames[0])) {
          templates.push(fileNames[0]);
          storage.set('templates', templates, function(error) {
            if (error) {
              console.error(error);
            }
          });
        }
      });
      openTemplate(fileNames[0]);
    }
  });
});
开发者ID:hack-rpi,项目名称:Email-Board,代码行数:27,代码来源:email.ts


示例3: installFailed

 function installFailed() {
     remote.dialog.showMessageBox({
         type: 'error',
         title: 'Installation failed',
         message: 'Failed to install PIP',
         detail: 'Please refer to https://pip.pypa.io for a detailed installation guide.',
         buttons: ['OK']
     });
 }
开发者ID:rose-m,项目名称:oSeed,代码行数:9,代码来源:ctrl.ts


示例4:

 .then((out) => {
     console.log(out);
     remote.dialog.showMessageBox({
         type: 'info',
         title: 'Installation successful',
         message: 'PIP was successfully installed.',
         buttons: ['OK']
     });
 }, (out) => {
开发者ID:rose-m,项目名称:oSeed,代码行数:9,代码来源:ctrl.ts


示例5: directoryChooser

export function directoryChooser(title?: string, defaultPath?: string) {

    return remote.dialog.showOpenDialog({
        defaultPath,
        title,
        properties: [
            "openDirectory",
        ],
    })[0];
}
开发者ID:atrauzzi,项目名称:Gerty,代码行数:10,代码来源:DirectoryChooser.ts


示例6: add

 /**
  * Display a dialog for selecting the library dir.
  */
 add() {
     dialog.showOpenDialog({
         title: 'Select Visualization Folder(s)',
         defaultPath: this.state.lastPath.value || DEFAULT_LIBRARY_PATH,
         properties: ['openDirectory', 'multiSelections']
     }, (paths: string[]) => {
         const entries = this.loadFromPaths(paths);
         if (0 < entries.length) {
             this.state.update('activeId', entries[0].id);
         }
     });
 }
开发者ID:michaelbromley,项目名称:skqw,代码行数:15,代码来源:v-selector.component.ts


示例7: fileChooser

export function fileChooser(multi: boolean, title?: string, defaultPath?: string) {

    const properties: OpenDialogOptions["properties"] = [
        "openFile",
    ];

    if (multi) {

        properties.push("multiSelections");
    }

    return remote.dialog.showOpenDialog({
        defaultPath,
        title,
        properties,
    });
}
开发者ID:atrauzzi,项目名称:Gerty,代码行数:17,代码来源:FileChooser.ts


示例8: sanitizeFilename

 r.onloadend = () => {
   const data = {
     name: sanitizeFilename(self.visState.title.toLowerCase().replace(/\s/g, '-')),
     image: r.result,
     format: 'png'
   };
   remote.dialog.showSaveDialog(
     remote.BrowserWindow.getAllWindows()[0],
     {
       title: 'Export to Image',
       defaultPath: sanitizeFilename(data.name + '.' + data.format)
     },
     (name: string) => {
       name && writeFileSync(name, arrayBufferToBuffer(data.image));
     }
   );
 };
开发者ID:chauey,项目名称:ngrev,代码行数:17,代码来源:export-to-image.service.ts


示例9: function

{
    const opened: boolean = webview.isDevToolsOpened();
    const focused: boolean = webview.isDevToolsFocused();
    const focused2: boolean = webview.getWebContents().isFocused();
}

// In guest page.
ipcRenderer.on('ping', function() {
	ipcRenderer.sendToHost('pong');
});


// showOpenDialog
// https://electron.atom.io/docs/api/dialog/#dialogshowopendialogbrowserwindow-options-callback

remote.dialog.showOpenDialog(win);
remote.dialog.showOpenDialog(win, {}, fileNames => fileNames);
remote.dialog.showOpenDialog(win, {
	title: 'foo',
	defaultPath: '/bar',
	buttonLabel: 'foo bar',
	filters: [
		{name: 'Images', extensions: ['jpg', 'png', 'gif']},
		{name: 'Movies', extensions: ['mkv', 'avi', 'mp4']},
		{name: 'Custom File Type', extensions: ['as']},
		{name: 'All Files', extensions: ['*']}
	],
	properties: ['openFile', 'openDirectory', 'multiSelections', 'showHiddenFiles', 'createDirectory', 'promptToCreate', 'noResolveAliases'],
	normalizeAccessKeys: true,
	message: 'foo message',
});
开发者ID:YousefED,项目名称:DefinitelyTyped,代码行数:31,代码来源:renderer.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript electron.remote.shell类代码示例发布时间:2022-05-25
下一篇:
TypeScript electron.remote.app类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap