當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Menu.setApplicationMenu方法代碼示例

本文整理匯總了TypeScript中electron.Menu.setApplicationMenu方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Menu.setApplicationMenu方法的具體用法?TypeScript Menu.setApplicationMenu怎麽用?TypeScript Menu.setApplicationMenu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在electron.Menu的用法示例。


在下文中一共展示了Menu.setApplicationMenu方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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

示例2: function

app.on('ready', function() {
  Menu.setApplicationMenu(menus);

  var mainWindow = createWindow('main', {
    width: 1000,
    height: 600
  });

  mainWindow.setTitle(require('../package.json').name);

  mainWindow.loadURL(
    url.format({
      pathname: join(__dirname, 'app.html'),
      protocol: 'file:',
      slashes: true
    })
  );

  if (env.name === 'development') {
    mainWindow.openDevTools();
  }

  const backgroundApp = new BackgroundApp();
  backgroundApp.init(getConfig());
});
開發者ID:chauey,項目名稱:ngrev,代碼行數:25,代碼來源:app.ts

示例3: buildDefaultMenu

 (event: Electron.IpcMessageEvent, labels: MenuLabels) => {
   menu = buildDefaultMenu(labels)
   Menu.setApplicationMenu(menu)
   if (mainWindow) {
     mainWindow.sendAppMenu()
   }
 }
開發者ID:ghmoore,項目名稱:desktop,代碼行數:7,代碼來源:main.ts

示例4: createWindow

export function createWindow() {

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

  // Create the browser window.
  win = new BrowserWindow({
    width: 1200,
    height: 900,
    title: pkg.productName,
    icon: path.join(__dirname, '../resources/icon.png')
  });

  Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));

  // and load the index.html of the app.
  win.loadURL(`file://${__dirname}/index.html`);

  // 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:uhlibraries-digital,項目名稱:brays,代碼行數:26,代碼來源:main.ts

示例5: onAppReady

function onAppReady() {
  electron.Menu.setApplicationMenu(null);

  getPaths((dataPathErr, pathToCore, pathToUserData) => {
    userDataPath = pathToUserData;
    corePath = pathToCore;

    getLanguageCode(userDataPath, (languageCode) => {
      i18n.languageCode = languageCode;
      i18n.load([ "startup", "tray" ], () => {
        if (dataPathErr != null) {
          electron.dialog.showErrorBox(i18n.t("startup:failedToStart"), i18n.t(dataPathErr.key, dataPathErr.variables));
          electron.app.quit();
          process.exit(1);
          return;
        }

        setupTrayOrDock();
        setupMainWindow();

        // NOTE: Disabled for now, see below
        // process.on("SIGINT", onSigInt);
      });
    });
  });
}
開發者ID:saucyfai,項目名稱:superpowers-app,代碼行數:26,代碼來源:main.ts

示例6: 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

示例7: Tray

app.on("ready", () => {
  // window
  MainWindow.getInstance().show()

  // tray
  const tray = new Tray(`${__dirname}/images/icon.png`)
  const menu = Menu.buildFromTemplate([
    {label: "Setting", click: () => SettingWindow.getInstance().show()},
    {label: "Quit", click: () => app.quit()},
  ])
  tray.setToolTip(app.getName())
  tray.setContextMenu(menu)

  // menu
  Menu.setApplicationMenu(Menu.buildFromTemplate([{
    label: "Application",
    submenu: [
      { label: "About Application", selector: "orderFrontStandardAboutPanel:" },
      { type: "separator" },
      { label: "Quit", accelerator: "Command+Q", click: () => app.quit() },
    ]}, {
    label: "Edit",
    submenu: [
      { label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
      { label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
      { type: "separator" },
      { label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
      { label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
      { label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
      { label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" },
    ]},
  ]))
})
開發者ID:namikingsoft,項目名稱:snotido,代碼行數:33,代碼來源:app.ts

示例8: 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

示例9:

const setApplicationMenu = () => {
  const menus = [editMenuTemplate];
  if (env.name !== 'production') {
    menus.push(devMenuTemplate);
  }
  Menu.setApplicationMenu(Menu.buildFromTemplate(menus));
};
開發者ID:Dorokhov,項目名稱:azure-tools,代碼行數:7,代碼來源:background.ts

示例10: function

var setApplicationMenu = function () {
    var menus :Electron.MenuItemOptions[];
    menus = [editMenuTemplate];
    if (env.name !== 'production') {
        menus.push(devMenuTemplate);
    }
    Menu.setApplicationMenu(Menu.buildFromTemplate(menus));
};
開發者ID:frieck,項目名稱:electron-angular2-boilerplate,代碼行數:8,代碼來源:background.ts


注:本文中的electron.Menu.setApplicationMenu方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。