當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。