mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-10-03 20:29:01 +00:00
singleInstance handle command line arguments
This commit is contained in:
@@ -50,7 +50,17 @@ app.on('will-finish-launching', () => {
|
||||
const manifestJsonFile = require(manifestJsonFilePath);
|
||||
if (manifestJsonFile.singleInstance || manifestJsonFile.aspCoreBackendPort) {
|
||||
const mainInstance = app.requestSingleInstanceLock();
|
||||
app.on('second-instance', () => {
|
||||
app.on('second-instance', (events, args = []) => {
|
||||
args.forEach(parameter => {
|
||||
const words = parameter.split('=');
|
||||
|
||||
if(words.length > 1) {
|
||||
app.commandLine.appendSwitch(words[0].replace('--', ''), words[1]);
|
||||
} else {
|
||||
app.commandLine.appendSwitch(words[0].replace('--', ''));
|
||||
}
|
||||
});
|
||||
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
if (windows.length) {
|
||||
if (windows[0].isMinimized()) {
|
||||
|
||||
Reference in New Issue
Block a user