
// 启动后台服务，作为基本的调用




// 引入electron框架
const { app, BrowserWindow } = require('electron')
/*获取electron窗体的菜单栏*/
const Menu = require('electron').Menu
/*隐藏electron创听的菜单栏*/
//调试禁用
Menu.setApplicationMenu(null)
//文件夹
const ipc = require('electron').ipcMain
const dialog = require('electron').dialog

ipc.on('open-file-dialog', function (event) {
    dialog.showOpenDialog({
      properties: ['openFile']
    }, function (files) {
      if (files) event.sender.send('selected-file', files)
    })
  })
ipc.on('open-directory-dialog', function (event) {
  dialog.showOpenDialog({
    properties: ['openDirectory']
  }, function (files) {
    if (files) event.sender.send('selected-directory', files)
  })
})

// 创建窗口
function createWindow () {
  // Create the browser window.
  let win = new BrowserWindow({
    width: 800,
    height: 620,
    webPreferences: {
      nodeIntegration: true
    }
  })
  

  // and load the index.html of the app.
  win.loadFile('index.html')
  
  
  //win.loadFile('index.html')
  //win.webContents.openDevTools()
  
}

// 启动
app.on('ready', createWindow)


