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


TypeScript electron.remote.Menu类代码示例

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


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

示例1: showContextMenu

function showContextMenu(e) {
	e.preventDefault();

	const pid = parseInt(e.currentTarget.id);
	if (pid && typeof pid === 'number') {
		const menu = new remote.Menu();
		menu.append(new remote.MenuItem({
			label: localize('killProcess', "Kill Process"),
			click() {
				process.kill(pid, 'SIGTERM');
			}
		})
		);

		menu.append(new remote.MenuItem({
			label: localize('forceKillProcess', "Force Kill Process"),
			click() {
				process.kill(pid, 'SIGKILL');
			}
		})
		);

		menu.popup(remote.getCurrentWindow());
	}
}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:25,代码来源:processExplorerMain.ts

示例2: constructor

 constructor() {
     var menu = remote.Menu.buildFromTemplate([{
         label: 'Raja',
         submenu: [
             {
                 label: 'open',
                 click: function(){
                   dialog.showOpenDialog((cb) => {
                       
                   })  
                 }
             },
             {
                 label: 'opencustom',
                 click: function(){
                   ipcRenderer.send('open-custom');
                       let notification = new Notification('Customdialog', {
                           body: 'This is a custom window created by us'
                       })
                     
                 }
             }
         ]
     }])
     remote.Menu.setApplicationMenu(menu);
 }
开发者ID:rajayogan,项目名称:angular2-desktop,代码行数:26,代码来源:app.ts

示例3: showContextMenu

function showContextMenu(e) {
	e.preventDefault();

	const menu = new remote.Menu();

	const pid = parseInt(e.currentTarget.id);
	if (pid && typeof pid === 'number') {
		menu.append(new remote.MenuItem({
			label: localize('killProcess', "Kill Process"),
			click() {
				process.kill(pid, 'SIGTERM');
			}
		}));

		menu.append(new remote.MenuItem({
			label: localize('forceKillProcess', "Force Kill Process"),
			click() {
				process.kill(pid, 'SIGKILL');
			}
		}));

		menu.append(new remote.MenuItem({
			type: 'separator'
		}));

		menu.append(new remote.MenuItem({
			label: localize('copy', "Copy"),
			click() {
				const row = document.getElementById(pid.toString());
				if (row) {
					clipboard.writeText(row.innerText);
				}
			}
		}));

		menu.append(new remote.MenuItem({
			label: localize('copyAll', "Copy All"),
			click() {
				const processList = document.getElementById('process-list');
				if (processList) {
					clipboard.writeText(processList.innerText);
				}
			}
		}));
	} else {
		menu.append(new remote.MenuItem({
			label: localize('copyAll', "Copy All"),
			click() {
				const processList = document.getElementById('process-list');
				if (processList) {
					clipboard.writeText(processList.innerText);
				}
			}
		}));
	}

	menu.popup({ window: remote.getCurrentWindow() });
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:58,代码来源:processExplorerMain.ts

示例4: isInProgress

            if (isKeybindingForEvent(event, KeyboardAction.cliHistoryPrevious)) {
                prompt.setPreviousHistoryItem();

                event.stopPropagation();
                event.preventDefault();
                return;
            }

            if (isKeybindingForEvent(event, KeyboardAction.cliHistoryNext)) {
                prompt.setNextHistoryItem();

                event.stopPropagation();
                event.preventDefault();
                return;
            }
        }
    }

    prompt.setPreviousKeyCode(event);
};

function isInProgress(job: JobComponent): boolean {
    return job.props.job.status === Status.InProgress;
}

const app = remote.app;
const browserWindow = remote.BrowserWindow.getAllWindows()[0];
const template = buildMenuTemplate(app, browserWindow);

remote.Menu.setApplicationMenu(remote.Menu.buildFromTemplate(template));
开发者ID:fabricionaweb,项目名称:black-screen,代码行数:30,代码来源:UserEventsHander.ts


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