TT .NET SDK event model
TT .NET SDK is inherently multi-threaded, using events to notify TT .NET SDK applications of new data, such as order status changes, price updates, or fill notifications. Because your applications can use multiple threads to access TT .NET SDK functionality, each thread that interacts with TT .NET SDK must have an attached Dispatcher object that routes events and data across threads.
TT .NET SDK supports the following Dispatcher types:
UIDispatcher, which uses the Windows Message Queue to manage events for Windows Forms threads. You create and attach a UIDispatcher to the current thread as follows:
UIDispatcher m_disp = Dispatcher.AttachUIDispatcher();
Note: .NET 5 does not support a UIDispatcher.
WorkerDispatcher, which uses the TT .NET SDK Message Queue to manage events for non-Windows Forms threads. You create and attach a WorkerDispatcher to the current thread as follows:
WorkerDispatcher m_disp = Dispatcher.AttachWorkerDispatcher();
Note that both the UIDispatcher and WorkerDispatcher classes derive from the UIDispatcher class. You can always access your current Dispatcher object in any TT .NET SDK thread by calling Dispatcher.Current.
Dispatcher Suggestions
The UIDispatcher is only supported on Windows Operating Systems. To support multiple platforms, the .NET 5 version of the TT .NET SDK does not support the UIDispatcher.
TT recommends writing a dispatcher to push messages to the UI thread for the specific operating system that will run the application.
For Windows users, TT suggests users look into System.Windows.Threading.Dispatcher to push messages to the UI.