Browse Source

Try again dialog if offline in setup

Former-commit-id: 0a8b0bf67a2bee33c955635f24c5104525748614
David Benson 7 years ago
parent
commit
633394e5cb
1 changed files with 22 additions and 0 deletions
  1. 22 0
      war/electron.js

+ 22 - 0
war/electron.js

@@ -109,6 +109,28 @@ function createWindow (opt = {})
 		console.log('Window closed idx:%d', index)
 		windowsRegistry.splice(index, 1)
 	})
+	
+	mainWindow.webContents.on('did-fail-load', function()
+    {
+        console.log('did-fail-load');
+        
+		var choice = dialog.showMessageBox(mainWindow,
+		{
+			type: 'question',
+			buttons: ['Try again', 'Quit'],
+			title: 'Launcher',
+			message: 'Ensure you are online to setup'
+		});
+			
+		if (choice === 0)
+		{
+			mainWindow.loadURL(wurl);
+		}
+		else if (choice === 1)
+		{
+			app.quit();
+		}
+    });
 
 	return mainWindow.id
 }