mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
Merge pull request #996 from softworkz/submit_singleinstance
Fix ElectronSingleInstance handling
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
public string RuntimeIdentifier { get; internal set; }
|
||||
|
||||
public string ElectronSingleInstance { get; internal set; }
|
||||
public bool ElectronSingleInstance { get; internal set; }
|
||||
|
||||
public string Title { get; internal set; }
|
||||
|
||||
|
||||
@@ -165,13 +165,9 @@
|
||||
ElectronNetRuntime.DotnetAppType = DotnetAppType.AspNetCoreApp;
|
||||
}
|
||||
|
||||
if (isSingleInstance?.Length > 0 && bool.TryParse(isSingleInstance, out var isSingleInstanceActive) && isSingleInstanceActive)
|
||||
if (bool.TryParse(isSingleInstance, out var parsedBool))
|
||||
{
|
||||
buildInfo.ElectronSingleInstance = "yes";
|
||||
}
|
||||
else
|
||||
{
|
||||
buildInfo.ElectronSingleInstance = "no";
|
||||
buildInfo.ElectronSingleInstance = parsedBool;
|
||||
}
|
||||
|
||||
if (httpPort?.Length > 0 && int.TryParse(httpPort, out var port))
|
||||
|
||||
@@ -93,7 +93,7 @@ app.on('will-finish-launching', () => {
|
||||
|
||||
const manifestJsonFile = require(manifestJsonFilePath);
|
||||
|
||||
if (manifestJsonFile.singleInstance === "yes") {
|
||||
if (manifestJsonFile.singleInstance) {
|
||||
const mainInstance = app.requestSingleInstanceLock();
|
||||
app.on('second-instance', (events, args = []) => {
|
||||
args.forEach((parameter) => {
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
<TemplateProperty Include="ElectronSplashScreen" Value="$(ElectronSplashScreenFileName)" />
|
||||
<TemplateProperty Include="ElectronVersion" Value="$(ElectronVersion)" />
|
||||
<TemplateProperty Include="TargetName" Value="$(ElectronTargetName)" />
|
||||
<TemplateProperty Include="ElectronSingleInstance" Value="$(ElectronSingleInstance)" />
|
||||
<TemplateProperty Include="ElectronSingleInstance" Value="$(ElectronSingleInstance.ToLower())" />
|
||||
</ItemGroup>
|
||||
|
||||
<MakeDir Directories="$(ElectronIntermediateOutputPath)" />
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"license": "$(License)",
|
||||
"executable": "$(TargetName)",
|
||||
"singleInstance": "$(ElectronSingleInstance)",
|
||||
"singleInstance": $(ElectronSingleInstance),
|
||||
"homepage": "$(ProjectUrl)",
|
||||
"splashscreen": {
|
||||
"imageFile": "$(ElectronSplashScreen)"
|
||||
|
||||
Reference in New Issue
Block a user