const {
    app,
    BrowserWindow,
    Menu,
    dialog,
    ipcMain
} = require('electron');
var win = {};

win.win = null;

ipcMain
    .on('winHide', (event, arg) => {
        console.log('minimize')
        win.win.minimize()
        //win.win.hide()
    })

win.createWindow = () => {
    win.win = new BrowserWindow({
        width: 1010,
        height: 800,
        minWidth: 1010,
        minHeight: 565,
        show: true,
        frame: false,
        icon: global.dir + '/app.ico'
    })
    win.win.loadURL(`file://${global.dir}/app/view/layout.html`);
    win.win.show();
    win.win.on('closed', () => {
        //win.win = null;
    });



    win.win.on('close', function(event) {

    });
}
win.open = () => {
    win.win.restore();
}
win.close = () => {
    win.win.close();
}
module.exports = win;
