diff --git a/ElectronNET.API/App.cs b/ElectronNET.API/App.cs
index a8e137a..1ae66c2 100644
--- a/ElectronNET.API/App.cs
+++ b/ElectronNET.API/App.cs
@@ -15,6 +15,11 @@ namespace ElectronNET.API
///
public sealed class App
{
+ ///
+ /// Print every message sent to the socket
+ ///
+ public static bool SocketDebug { get; set; }
+
///
/// Emitted when all windows have been closed.
///
diff --git a/ElectronNET.API/BridgeConnector.cs b/ElectronNET.API/BridgeConnector.cs
index bb5c444..b5ae092 100644
--- a/ElectronNET.API/BridgeConnector.cs
+++ b/ElectronNET.API/BridgeConnector.cs
@@ -10,12 +10,24 @@ namespace ElectronNET.API
private static SocketIO _socket;
private static object _syncRoot = new object();
-
public static void Emit(string eventString, params object[] args)
{
//We don't care about waiting for the event to be emitted, so this doesn't need to be async
- Task.Run(() => Socket.EmitAsync(eventString, args));
+ Task.Run(async () =>
+ {
+ await Task.Yield();
+ if (App.SocketDebug)
+ {
+ Console.WriteLine($"Sending event {eventString}");
+ }
+ await Socket.EmitAsync(eventString, args);
+
+ if (App.SocketDebug)
+ {
+ Console.WriteLine($"Sent event {eventString}");
+ }
+ });
}
public static void Off(string eventString) => Socket.Off(eventString);
diff --git a/ElectronNET.API/GlobalShortcut.cs b/ElectronNET.API/GlobalShortcut.cs
index 2109e29..5a68272 100644
--- a/ElectronNET.API/GlobalShortcut.cs
+++ b/ElectronNET.API/GlobalShortcut.cs
@@ -71,10 +71,10 @@ namespace ElectronNET.API
public Task IsRegisteredAsync(string accelerator)
{
var taskCompletionSource = new TaskCompletionSource();
-
- BridgeConnector.On("globalShortcut-isRegisteredCompleted", (isRegistered) =>
+
+ BridgeConnector.On("globalShortcut-isRegisteredCompleted" + accelerator.GetHashCode(), (isRegistered) =>
{
- BridgeConnector.Off("globalShortcut-isRegisteredCompleted");
+ BridgeConnector.Off("globalShortcut-isRegisteredCompleted" + accelerator.GetHashCode());
taskCompletionSource.SetResult(isRegistered);
});
diff --git a/ElectronNET.CLI/Properties/launchSettings.json b/ElectronNET.CLI/Properties/launchSettings.json
index 5e28f7a..df963f9 100644
--- a/ElectronNET.CLI/Properties/launchSettings.json
+++ b/ElectronNET.CLI/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"ElectronNET.CLI": {
"commandName": "Project",
- "commandLineArgs": "start /project-path \"$(SolutionDir)ElectronNET.WebApp\" /watch"
+ "commandLineArgs": "start /project-path \"$(SolutionDir)ElectronNET.WebApp\""
},
"test": {
"commandName": "Project",
diff --git a/ElectronNET.WebApp/Properties/launchSettings.json b/ElectronNET.WebApp/Properties/launchSettings.json
index 8ba0307..32efbcd 100644
--- a/ElectronNET.WebApp/Properties/launchSettings.json
+++ b/ElectronNET.WebApp/Properties/launchSettings.json
@@ -11,7 +11,7 @@
"Electron.NET App": {
"commandName": "Executable",
"executablePath": "$(SolutionDir)ElectronNET.CLI\\bin\\Debug\\net5.0\\dotnet-electronize-h5.exe",
- "commandLineArgs": "start",
+ "commandLineArgs": "start /from-build-output $(SolutionDir)ElectronNET.WebApp\\bin\\$(Configuration)\\net5.0",
"workingDirectory": "$(SolutionDir)ElectronNET.WebApp"
},
"IIS Express": {