mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-08-12 11:09:49 +00:00
fix ElectronHostHook path, exception handling
This commit is contained in:
@@ -34,7 +34,15 @@ namespace ElectronNET.API
|
||||
|
||||
public void Call(string socketEventName, params dynamic[] arguments)
|
||||
{
|
||||
BridgeConnector.Socket.Emit(socketEventName, arguments);
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On(socketEventName + "Error" + guid, (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off(socketEventName + "Error" + guid);
|
||||
Electron.Dialog.ShowErrorBox("Host Hook Exception", result.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit(socketEventName, arguments, guid);
|
||||
}
|
||||
|
||||
public Task<T> CallAsync<T>(string socketEventName, params dynamic[] arguments)
|
||||
@@ -42,6 +50,12 @@ namespace ElectronNET.API
|
||||
var taskCompletionSource = new TaskCompletionSource<T>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On(socketEventName + "Error" + guid, (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off(socketEventName + "Error" + guid);
|
||||
Electron.Dialog.ShowErrorBox("Host Hook Exception", result.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.On(socketEventName + "Complete" + guid, (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off(socketEventName + "Complete" + guid);
|
||||
|
||||
Reference in New Issue
Block a user