mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-21 14:35:16 +00:00
Fixed single instance behavior
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
- Updated `PrintToPDFOptions` to also allow specifying the `PageSize` with an object (#769)
|
||||
- Updated splashscreen image to have 0 margin (#622)
|
||||
- Fixed single instance behavior using the `ElectronSingleInstance` property (#901)
|
||||
- Added option to use `ElectronSplashScreen` with an HTML file (#799)
|
||||
- Added option to provide floating point value as aspect ratios with `SetAspectRatio` (#793)
|
||||
|
||||
|
||||
@@ -136,18 +136,26 @@
|
||||
buildInfo.ElectronExecutable = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.ElectronExecutable))?.Value;
|
||||
buildInfo.ElectronVersion = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.ElectronVersion))?.Value;
|
||||
buildInfo.RuntimeIdentifier = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.RuntimeIdentifier))?.Value;
|
||||
buildInfo.ElectronSingleInstance = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.ElectronSingleInstance))?.Value;
|
||||
buildInfo.Title = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.Title))?.Value;
|
||||
buildInfo.Version = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.Version))?.Value;
|
||||
buildInfo.BuildConfiguration = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.BuildConfiguration))?.Value;
|
||||
var isAspNet = attributes.FirstOrDefault(e => e.Key == "IsAspNet")?.Value;
|
||||
var isSingleInstance = attributes.FirstOrDefault(e => e.Key == nameof(buildInfo.ElectronSingleInstance))?.Value;
|
||||
var httpPort = attributes.FirstOrDefault(e => e.Key == "AspNetHttpPort")?.Value;
|
||||
|
||||
if (isAspNet?.Length > 0 && bool.TryParse(isAspNet, out var res) && res)
|
||||
{
|
||||
ElectronNetRuntime.DotnetAppType = DotnetAppType.AspNetCoreApp;
|
||||
}
|
||||
|
||||
var httpPort = attributes.FirstOrDefault(e => e.Key == "AspNetHttpPort")?.Value;
|
||||
if (isSingleInstance?.Length > 0 && bool.TryParse(isSingleInstance, out var res) && res)
|
||||
{
|
||||
buildInfo.ElectronSingleInstance = "yes";
|
||||
}
|
||||
else
|
||||
{
|
||||
buildInfo.ElectronSingleInstance = "no";
|
||||
}
|
||||
|
||||
if (httpPort?.Length > 0 && int.TryParse(httpPort, out var port))
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ app.on('will-finish-launching', () => {
|
||||
|
||||
const manifestJsonFile = require(manifestJsonFilePath);
|
||||
|
||||
if (manifestJsonFile.singleInstance) {
|
||||
if (manifestJsonFile.singleInstance === "yes") {
|
||||
const mainInstance = app.requestSingleInstanceLock();
|
||||
app.on('second-instance', (events, args = []) => {
|
||||
args.forEach((parameter) => {
|
||||
|
||||
Reference in New Issue
Block a user