Skip to content
This repository has been archived by the owner on Mar 17, 2019. It is now read-only.

Commit

Permalink
https://github.com/binjospookie/--shots/issues/18
Browse files Browse the repository at this point in the history
  • Loading branch information
binjospookie authored Feb 8, 2017
1 parent 3b85a13 commit bf53612
Showing 1 changed file with 24 additions and 32 deletions.
56 changes: 24 additions & 32 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,21 @@ ipcMain.on('synchronous-message', (event, arg, data) => {
event.returnValue = 'data';
} else if (arg === 'version') {
event.returnValue = app.getVersion();
} else {
} else if (arg === 'createNew') {
if (data === 'ask') {
dialog.showMessageBox(newShotDialog, function(index) {
// если пользователь подтвердил выбор — далем новый скриншот
if (index === 0) {
appWindow.webContents.send('new');
}
event.returnValue = 'not-ok';
})
} else {
appWindow.webContents.send('new');
event.returnValue = 'ok';
}
// event.returnValue = app.getVersion();
} else{
appWindow.show();
appWindow.setPosition(0,0);
const {width, height} = electron.screen.getPrimaryDisplay().workAreaSize;
Expand Down Expand Up @@ -191,9 +205,11 @@ function createWindow() {
} else {
appWindow.loadURL(`file://${__dirname}/index.html`);
}

if (argv.debug) {
appWindow.webContents.openDevTools();
}

appWindow.on('closed', function() {
appWindow = null;
});
Expand Down Expand Up @@ -254,16 +270,8 @@ function createContextMenu(newShot, open, tray) {
appFirstStart = false;
return;
}

dialog.showMessageBox(newShotDialog, function(index) {
// если пользователь подтвердил выбор — далем новый скриншот
if (index === 0) {
app.createShot = true;
appWindow.webContents.send('new');
appWindow.setPosition(0,0);
appWindow.show();
}
})
app.createShot = true;
appWindow.webContents.send('saveState');
}
},
{
Expand Down Expand Up @@ -367,16 +375,8 @@ Example:
case '--new':
case '-new':
case '-n':
dialog.showMessageBox(newShotDialog, function(index) {
// если пользователь подтвердил выбор — далем новый скриншот
if (index === 0) {
app.createShot = true;
appWindow.webContents.send('new');
appWindow.setPosition(0,0);
appWindow.show();
appFirstStart = false;
}
})
app.createShot = true;
appWindow.webContents.send('saveState');
break;
case '--save':
case '-save':
Expand Down Expand Up @@ -409,16 +409,8 @@ function rigesterGlobalHotkey() {
appFirstStart = false;
return;
}

dialog.showMessageBox(newShotDialog, function(index) {
// если пользователь подтвердил выбор — далем новый скриншот
if (index === 0) {
app.createShot = true;
appWindow.webContents.send('new');
appWindow.setPosition(0,0);
appWindow.show();
appWindow.focus();
}
})

app.createShot = true;
appWindow.webContents.send('saveState');
})
}

0 comments on commit bf53612

Please sign in to comment.