/// <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_fs != null) { m_fs.FillAdded -= m_fs_FillAdded; m_fs.FillBookDownload -= m_fs_FillBookDownload; m_fs.FillListEnd -= m_fs_FillListEnd; m_fs.FillListStart -= m_fs_FillListStart; m_fs.Dispose(); m_fs = null; } // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_fillSubscription != null) { m_fillSubscription.FillListEnd -= m_FillSubscription_FillListEnd; m_fillSubscription.FillListStart -= m_FillSubscription_FillListStart; m_fillSubscription.FillBookDownload -= m_FillSubscription_FillBookDownload; m_fillSubscription.FillAdded -= m_FillSubscription_FillAdded; m_fillSubscription.FillDeleted -= m_FillSubscription_FillDeleted; m_fillSubscription.FillAmended -= m_FillSubscription_FillAmended; m_fillSubscription.Dispose(); m_fillSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }