/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (m_lock) { if (!m_disposed) { // Unattached callbacks and dispose of all subscriptions if (m_req1 != null) { m_req1.Update -= m_req_Update; m_req1.Dispose(); m_req1 = null; } if (m_req2 != null) { m_req2.Update -= m_req_Update; m_req2.Dispose(); m_req2 = null; } if (m_ps != null) { m_ps.FieldsUpdated -= m_ps_FieldsUpdated; m_ps.Dispose(); m_ps = null; } if (m_ts != null) { m_ts.OrderAdded -= m_ts_OrderAdded; m_ts.OrderDeleted -= m_ts_OrderDeleted; m_ts.OrderFilled -= m_ts_OrderFilled; m_ts.OrderRejected -= m_ts_OrderRejected; m_ts.OrderUpdated -= m_ts_OrderUpdated; m_ts.Dispose(); m_ts = null; } if (m_casReq != null) { m_casReq.Completed -= m_casReq_Completed; m_casReq.Dispose(); m_casReq = null; } // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }