You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there are two ways of enforcing an app to be single instance.
Set "singleInstance": true in the electron manifest json
Write code in .NET to request the single instance lock and handle the second instance accordingly.
The first option seems to be the most reliable and robust. It works the fastest since it is being done in the javascript before the ASP .NET Core application launches (at least that is my understanding). However, one major problem is that you cannot handle the command line arguments to this second instance.
The alternative to this, is to set this to false and write the code to handle it ourselves, but this has several problems. Firstly, I can't get the callback to work, see #519 . Secondly, the second instance will always launch the splash screen, which is undesired if I have an instance running (and not a problem using the singleInstance in the manifest).
I really think both problems should be fixed, but I would be happy with one of the following two solutions.
Solution 1: Allow the javascript to take arguments and pass them to .NET. Then we can just check for the lock and handle the arguments.
Solution 2: Provide a new setting to the electron.manifest.json that will cause main.js to first check if it has the lock, and if it does not have the lock, don't display the Splashscreen, but continue to call the ASP .NET Core stuff so that we can handle the arguments.
I believe the only work around (assuming I can get the callback working or that gets fixed), is to handle showing the splash screen myself. That concerns me because I believe the app will seem more responsive at launch when the javascript launches the splash screen. My app seems to take a long time to load, and I am concerned that the splash screen will take a long time to show up if I write that code myself in .NET
The text was updated successfully, but these errors were encountered:
Hi @Delpire, this feature is implemented for the next Electron.NET 13.5.1 release.
If the second instance is opened with arguments, the main application that has landed receives a focus. If you subscribe to this event, you can also request your new arguments.
Currently there are two ways of enforcing an app to be single instance.
"singleInstance": true
in the electron manifest jsonThe first option seems to be the most reliable and robust. It works the fastest since it is being done in the javascript before the ASP .NET Core application launches (at least that is my understanding). However, one major problem is that you cannot handle the command line arguments to this second instance.
The alternative to this, is to set this to false and write the code to handle it ourselves, but this has several problems. Firstly, I can't get the callback to work, see #519 . Secondly, the second instance will always launch the splash screen, which is undesired if I have an instance running (and not a problem using the
singleInstance
in the manifest).I really think both problems should be fixed, but I would be happy with one of the following two solutions.
Solution 1: Allow the javascript to take arguments and pass them to .NET. Then we can just check for the lock and handle the arguments.
Solution 2: Provide a new setting to the electron.manifest.json that will cause main.js to first check if it has the lock, and if it does not have the lock, don't display the Splashscreen, but continue to call the ASP .NET Core stuff so that we can handle the arguments.
I believe the only work around (assuming I can get the callback working or that gets fixed), is to handle showing the splash screen myself. That concerns me because I believe the app will seem more responsive at launch when the javascript launches the splash screen. My app seems to take a long time to load, and I am concerned that the splash screen will take a long time to show up if I write that code myself in .NET
The text was updated successfully, but these errors were encountered: