Added warning message on exit while rendering

This commit is contained in:
2022-06-23 12:34:40 +02:00
parent 3607233df6
commit 1a22c55572
3 changed files with 34 additions and 1 deletions

View File

@@ -76,12 +76,35 @@ const createWindow = () => {
mainWindow.loadFile(path.join(__dirname, 'index.html'));
ipcMain.on('closeApp', () => {
app.quit();
mainWindow.webContents.send('isRenderActiveClose');
});
ipcMain.on('minimize', () => {
mainWindow.minimize();
});
ipcMain.on('renderInactiveClose', () => {
app.quit();
});
ipcMain.on('renderActiveClose', async () => {
const response = await dialog.showMessageBox({
type: 'warning',
noLink: true,
buttons: ['Cancel', 'Exit'],
defaultId: 0,
title: 'Close',
message: 'A video is still being renderd!',
detail:
'If you close the application, the progress will be lost!',
});
if (response.response === 1) {
app.quit();
}
});
mainWindow.on('close', () => {
mainWindow.webContents.send('closeApp');
});
};
// This method will be called when Electron has finished