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


TypeScript BrowserWindow.setMenu方法代码示例

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


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

示例1: Promise

    return new Promise(resolve => {
        if (isDev || !isAnySetupRequired()) {
            const {
                loadExtensions
            } = require("eez-studio-shared/extensions/extensions") as typeof ExtensionsModule;
            loadExtensions();

            resolve();
            return;
        }

        let win = new BrowserWindow({
            width: 600,
            height: 200,
            backgroundColor: "#333",
            show: false
        });

        win.setMenu(null);
        win.loadURL(`file://${__dirname}/../setup/setup.html`);

        win.show();

        ipcMain.on("startSetup", async (event: Event) => {
            await doSetup(event.sender);
            win.close();
            resolve();
        });
    });
开发者ID:eez-open,项目名称:studio,代码行数:29,代码来源:setup.ts

示例2: getCurrentSchedule

 getCurrentSchedule((schedule) => {
   let posterWindow = new BrowserWindow({width: 795, height: 800, show: debug});
   if (debug) {
     posterWindow.webContents.openDevTools();
   }
   posterWindow.setMenu(null);
   posterWindow.loadURL(`file://${__dirname}/poster.html`);
   ipcMain.once('+main:poster-angular-up', () => {
     if (debug) {
       posterWindow.webContents.send('+view:debug-enabled');
     }
     posterWindow.webContents.send('+view:open-schedule', schedule, month);
   });
   ipcMain.once('+main:poster-ready', () => {
     posterWindow.webContents['_printToPDF'](posterPrintingSetting, (err, data) => {
       if (err) throw err;
       fs.writeFile(filename, data, (err) => {
         if (err) throw err;
         console.log('Write PDF successfully.');
         dialog.showMessageBox({
           type: 'info',
           title: 'PDF Saved',
           message: 'Poster rendered and saved to file.',
           buttons: ['OK'],
         });
         if (!debug) {
           posterWindow.close();
         }
       });
     });
   });
 });
开发者ID:molisani,项目名称:fcp-schedule,代码行数:32,代码来源:electron-main.ts

示例3: createWindow

function createWindow() {

  const electronScreen = screen;
  const size = electronScreen.getPrimaryDisplay().workAreaSize;

  // Create the browser window.
  win = new BrowserWindow({
    x: 0,
    y: 0,
    width: 295,
    height: 315,
    resizable: false,
    icon: __dirname + '/favicon.jpg'
   // width: size.width,
   // height: size.height
  });
  win.setMenu(null);
  win.setAlwaysOnTop(true, "floating", 1);
  // and load the index.html of the app.
  win.loadURL('file://' + __dirname + '/index.html');

  // Open the DevTools.
  if (serve) {
    win.webContents.openDevTools();
  }

  // Emitted when the window is closed.
  win.on('closed', () => {
    // Dereference the window object, usually you would store window
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    win = null;
  });
}
开发者ID:luciancah,项目名称:upbit-real-time-pricing,代码行数:34,代码来源:main.ts

示例4: createWindow

function createWindow() {
  mainWindow = new BrowserWindow({height: 650, width: 900, show: debug});
  if (debug) {
    mainWindow.webContents.openDevTools();
  }
  mainWindow.loadURL(`file://${__dirname}/index.html`);
  if (process.platform === 'darwin') {
    Menu.setApplicationMenu(createMenu());
  } else {
    mainWindow.setMenu(createMenu());
  }
  ipcMain.once('+main:angular-up', () => {
    if (debug) {
      mainWindow.webContents.send('+view:debug-enabled');
    }
    if (startFile) {
      openScheduleFromFile(startFile);
    }
    mainWindow.show();
  });
  ipcMain.on('+main:new-schedule', () => {
    createNewSchedule();
  });
  ipcMain.on('+main:open-schedule', () => {
    openScheduleFileDialog();
  });
  mainWindow.on('closed', () => {
    mainWindow = null;
    app.quit();
  });
};
开发者ID:molisani,项目名称:fcp-schedule,代码行数:31,代码来源:electron-main.ts

示例5: BrowserWindow

app.on('ready', () => {
    mainWindow = new BrowserWindow({
        height: 600,
        width: 800,
        minWidth: 600,
        minHeight: 400,
        backgroundColor: '#000'
    });
    mainWindow.loadURL('file://' + __dirname + '/index.html');
    mainWindow.setMenu(null);

    // open external (target="_blank") links in browser.
    mainWindow.webContents.on('new-window', (e, url) => {
        e.preventDefault();
        shell.openExternal(url);
    });

    mainWindow.webContents.on('devtools-opened', () => {
        mainWindow.webContents.send(OPEN_DEVTOOLS);
    });

    mainWindow.webContents.on('devtools-closed', () => {
        mainWindow.webContents.send(CLOSE_DEVTOOLS);
    });

    mainWindow.on('close', () => {
        sampleSubscription.unsubscribe();
        if (remoteWindow && !remoteWindow.isDestroyed()) {
            remoteWindow.close();
        }
    });
});
开发者ID:michaelbromley,项目名称:skqw,代码行数:32,代码来源:index.ts

示例6: BrowserWindow

app.on('ready', () => {
	mainWindow = new BrowserWindow({ width: 400, height: 400, frame: false })
	mainWindow.loadURL(`file://${__dirname}/renderer/index.html`)
	mainWindow.webContents.openDevTools() // TODO: only if debug mode
	mainWindow.on('closed', (): void => mainWindow = null)
	mainWindow.setMenu(null)
})
开发者ID:castaneai,项目名称:nowpl,代码行数:7,代码来源:app.ts

示例7: function

Electron.app.on('ready', function() {
  mainWindow = new Electron.BrowserWindow({
    width: 800,
    height: 600,
    minWidth: 300,
    minHeight: 300
  });

  mainWindow.setMenu(null);
  mainWindow.webContents.loadURL(`file://${__dirname}/client/index.html`);

  mainWindow.on('close', function() {
    mainWindow = null;
  });
});
开发者ID:zenwarr,项目名称:microhex-js,代码行数:15,代码来源:app.ts

示例8: createWindow

function createWindow() {
    win = new BrowserWindow({ width: 800, height: 600, show: false });
    win.setMenu(null);
    win.setMenuBarVisibility(false);
    win.maximize();
    win.loadURL("http://localhost:8080");

    win.once('ready-to-show', () => {
        win && win.show()
    });

    win.on("closed", () => {
        win = null;
    });
}
开发者ID:remipassmoilesel,项目名称:Abcmap,代码行数:15,代码来源:electron-main.ts

示例9: createWindow

function createWindow() {
	'use strict';
	let browserWindowOptions: Electron.BrowserWindowOptions = {
		width: 1000,
		height: 600,
		webPreferences: {
			plugins: true,
		},
	};
	mainWindow = new electron.BrowserWindow(browserWindowOptions);
	mainWindow.setMenu(null);
	mainWindow.loadURL('file://' + __dirname + '/../browser/index.html');
	// mainWindow.webContents.openDevTools();
	mainWindow.on('closed', () => {
		mainWindow = undefined;
	});
}
开发者ID:data9824,项目名称:SavannaTalk,代码行数:17,代码来源:main.ts

示例10: async

const createWindow = async () => {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  });

  mainWindow.setMenu(null);

  mainWindow.loadURL(`file://${__dirname}/index.html`);

  if (isDevMode) {
    mainWindow.webContents.openDevTools();
  }

  mainWindow.on('closed', () => {
    mainWindow = null;
  });
};
开发者ID:JimmyBoh,项目名称:bio-sim,代码行数:18,代码来源:index.ts


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