mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-19 15:16:20 +00:00
fix wrong Id being passed - needed browser id, not webcontent id
This commit is contained in:
@@ -69,28 +69,29 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
/// <param name="channel">Channelname.</param>
|
||||
/// <param name="listener">Callback Method.</param>
|
||||
public void OnWithId(string channel, Action<int, object> listener)
|
||||
public void OnWithId(string channel, Action<(int browserId, int webContentId, object arguments)> listener)
|
||||
{
|
||||
BridgeConnector.Emit("registerIpcMainChannelWithId", channel);
|
||||
BridgeConnector.Off(channel);
|
||||
BridgeConnector.On<ArgsAndId>(channel, (data) =>
|
||||
BridgeConnector.On<ArgsAndIds>(channel, (data) =>
|
||||
{
|
||||
var objectArray = FormatArguments(data.args);
|
||||
|
||||
if (objectArray.Count == 1)
|
||||
{
|
||||
listener(data.id, objectArray.First());
|
||||
listener((data.id, data.wcId, objectArray.First()));
|
||||
}
|
||||
else
|
||||
{
|
||||
listener(data.id, objectArray);
|
||||
listener((data.id, data.wcId, objectArray));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class ArgsAndId
|
||||
private class ArgsAndIds
|
||||
{
|
||||
public int id { get; set; }
|
||||
public int wcId { get; set; }
|
||||
public object[] args { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user