Skip to content

Commit 524e6c8

Browse files
fix planned breaking API changes from Electron 4.0
1 parent 17399f3 commit 524e6c8

34 files changed

+867
-476
lines changed

ElectronNET.API/App.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,21 +1029,21 @@ public void SetJumpList(JumpListCategory[] jumpListCategories)
10291029
/// <returns>This method returns false if your process is the primary instance of
10301030
/// the application and your app should continue loading. And returns true if your
10311031
/// process has sent its parameters to another instance, and you should immediately quit.</returns>
1032-
public async Task<bool> MakeSingleInstanceAsync(Action<string[], string> newInstanceOpened, CancellationToken cancellationToken = default(CancellationToken))
1032+
public async Task<bool> RequestSingleInstanceLockAsync(Action<string[], string> newInstanceOpened, CancellationToken cancellationToken = default(CancellationToken))
10331033
{
10341034
cancellationToken.ThrowIfCancellationRequested();
10351035

10361036
var taskCompletionSource = new TaskCompletionSource<bool>();
10371037
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
10381038
{
1039-
BridgeConnector.Socket.On("appMakeSingleInstanceCompleted", (success) =>
1039+
BridgeConnector.Socket.On("appRequestSingleInstanceLockCompleted", (success) =>
10401040
{
1041-
BridgeConnector.Socket.Off("appMakeSingleInstanceCompleted");
1041+
BridgeConnector.Socket.Off("appRequestSingleInstanceLockCompleted");
10421042
taskCompletionSource.SetResult((bool)success);
10431043
});
10441044

1045-
BridgeConnector.Socket.Off("newInstanceOpened");
1046-
BridgeConnector.Socket.On("newInstanceOpened", (result) =>
1045+
BridgeConnector.Socket.Off("secondInstance");
1046+
BridgeConnector.Socket.On("secondInstance", (result) =>
10471047
{
10481048
JArray results = (JArray)result;
10491049
string[] args = results.First.ToObject<string[]>();
@@ -1052,7 +1052,7 @@ public void SetJumpList(JumpListCategory[] jumpListCategories)
10521052
newInstanceOpened(args, workdirectory);
10531053
});
10541054

1055-
BridgeConnector.Socket.Emit("appMakeSingleInstance");
1055+
BridgeConnector.Socket.Emit("appRequestSingleInstanceLock");
10561056

10571057
return await taskCompletionSource.Task
10581058
.ConfigureAwait(false);
@@ -1063,9 +1063,9 @@ public void SetJumpList(JumpListCategory[] jumpListCategories)
10631063
/// Releases all locks that were created by makeSingleInstance. This will allow
10641064
/// multiple instances of the application to once again run side by side.
10651065
/// </summary>
1066-
public void ReleaseSingleInstance()
1066+
public void ReleaseSingleInstanceLock()
10671067
{
1068-
BridgeConnector.Socket.Emit("appReleaseSingleInstance");
1068+
BridgeConnector.Socket.Emit("appReleaseSingleInstanceLock");
10691069
}
10701070

10711071
/// <summary>
@@ -1155,7 +1155,8 @@ public void SetAppUserModelId(string id)
11551155
/// <summary>
11561156
/// Memory and cpu usage statistics of all the processes associated with the app.
11571157
/// </summary>
1158-
/// <returns></returns>
1158+
/// <returns>Array of ProcessMetric objects that correspond to memory and cpu usage
1159+
/// statistics of all the processes associated with the app.</returns>
11591160
public async Task<ProcessMetric[]> GetAppMetricsAsync(CancellationToken cancellationToken = default(CancellationToken))
11601161
{
11611162
cancellationToken.ThrowIfCancellationRequested();

ElectronNET.API/Entities/HighlightMode.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ public enum HighlightMode
1818
/// <summary>
1919
/// Never highlight the tray icon.
2020
/// </summary>
21-
never
21+
never,
22+
23+
/// <summary>
24+
/// Activate highlight the tray icon.
25+
/// </summary>
26+
on,
27+
28+
/// <summary>
29+
/// Deactivate highlight the tray icon.
30+
/// </summary>
31+
off
2232
}
2333
}

ElectronNET.API/Entities/WebPreferences.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public class WebPreferences
126126
/// A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to
127127
/// enable.The full list of supported feature strings can be found in the file.
128128
/// </summary>
129-
public string BlinkFeatures { get; set; }
129+
public string EnableBlinkFeatures { get; set; }
130130

131131
/// <summary>
132132
/// A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to

ElectronNET.CLI/Commands/BuildCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public Task<bool> ExecuteAsync()
9191
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
9292

9393
Console.WriteLine("Start npm install...");
94-
ProcessHelper.CmdExecute("npm install", tempPath);
94+
ProcessHelper.CmdExecute("npm install --production", tempPath);
9595

9696
Console.WriteLine("Start npm install electron-packager...");
9797

ElectronNET.Host/.vscode/tasks.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
// See https://go.microsoft.com/fwlink/?LinkId=733558
3-
// for the documentation about the tasks.json format
42
"version": "2.0.0",
53
"tasks": [
64
{

ElectronNET.Host/api/app.js

Lines changed: 40 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)