internal void FireAsyncMessageReceivedEvent(AsyncMessageEventArgs args) { if (AsyncMessageReceived != null) { AsyncMessageReceived(this, args); } }
void OnAsyncMessageReceived(object sender, MessageReceivedEventArgs args) { AsyncMessageEventArgs rpcr = new AsyncMessageEventArgs(args.Message.Body); _extensionManager.FireAsyncMessageReceivedEvent(rpcr); //args.Result.Body = rpcr.Body; args.Message.Body = rpcr.Body; }
void OnAsyncMessageReceived(object sender, MessageReceivedEventArgs args) { try { AsyncMessageEventArgs rpcr = new AsyncMessageEventArgs(args.Message.Body); _extensionManager.FireAsyncMessageReceivedEvent(rpcr); //args.Result.Body = rpcr.Body; args.Message.Body = rpcr.Body; } catch (Exception ex) { _extensionManager.ConsoleWriteLine($"[{(ex.TargetSite.DeclaringType as IExtension)?.Name ?? ex.TargetSite.DeclaringType.FullName}] threw {ex.GetType().FullName} on async message"); _extensionManager.ConsoleWriteLine(" --- Stacktrace --- "); _extensionManager.ConsoleWriteLine(ex.StackTrace); _extensionManager.ConsoleWriteLine(" --- Stacktrace end --- "); } }
private void pm_AsyncMessageReceived(object sender, AsyncMessageEventArgs e) { _dispatcher.InvokeAsync(() => _packetUi.PacketListBox.Items.Add(new AsyncListItem(e.Body))); }