¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Sockets based trading program, which language to use, C#,Java,C++ ?


 

Using a union message handler is a great idea!.
That is exactly what IB does in their SampleApp using a delegate and a message handler method.
This is IB's code:

delegate void MessageHandlerDelegate(IBMessage message);

And for thread safety:

?public void HandleMessage(IBMessage message)
??????? {
??????????? if (this.InvokeRequired)
??????????? {
??????????????? MessageHandlerDelegate callback = new MessageHandlerDelegate(HandleMessage);
??????????????? this.Invoke(callback, new object[] { message });
??????????? }
??????????? else
??????????? {
??????????????? UpdateUI(message);
??????????? }
??????? }

Their IBMessage is an abstract class which they extend in a whole bunch of "message" objects.? Then process the messages with a Huge switch/case statement to up the user interface.?

I'm trying to figure out a way to make it cleaner for my own general use.??? And figure out how they (IB) do some neat stuff with some of the UI controls.
Hope it works.

Thanks
John

Join [email protected] to automatically receive all group messages.