16 using System.Collections.Generic;
30 private volatile bool _loaded;
31 private Queue<Packet> _queue;
49 _queue =
new Queue<Packet>();
51 ConsumerReadyEvent += () => { _loaded =
true; };
71 #pragma warning disable 1591
72 public delegate
void DebugEventRaised(
DebugPacket packet);
73 public event DebugEventRaised DebugEvent;
76 #pragma warning disable 0067 // SystemDebugEvent is not used currently; ignore the warning
77 public event SystemDebugEventRaised SystemDebugEvent;
78 #pragma warning restore 0067
80 public delegate
void LogEventRaised(
LogPacket packet);
81 public event LogEventRaised LogEvent;
84 public event RuntimeErrorEventRaised RuntimeErrorEvent;
87 public event HandledErrorEventRaised HandledErrorEvent;
90 public event BacktestResultEventRaised BacktestResultEvent;
92 public delegate
void ConsumerReadyEventRaised();
93 public event ConsumerReadyEventRaised ConsumerReadyEvent;
94 #pragma warning restore 1591
104 _queue.Enqueue(packet);
109 while (_queue.TryDequeue(out var item))
115 ProcessPacket(packet);
124 if (!notification.CanSend())
126 Log.
Error(
"Messaging.SendNotification(): Send not implemented for notification of type: " + notification.GetType().Name);
137 while (_loaded && _queue.TryDequeue(out var item))
146 private void ProcessPacket(
Packet packet)
188 var handler = DebugEvent;
202 var handler = DebugEvent;
216 var handler = ConsumerReadyEvent;
228 var handler = LogEvent;
240 var handler = HandledErrorEvent;
252 var handler = RuntimeErrorEvent;
264 var handler = BacktestResultEvent;