示例#1
0
        /// <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_req != null)
                    {
                        m_req.Update -= m_req_Update;
                        m_req.Dispose();
                        m_req = null;
                    }
                    if (m_ps != null)
                    {
                        m_ps.FieldsUpdated -= m_ps_FieldsUpdated;
                        m_ps.Dispose();
                        m_ps = null;
                    }

                    // Begin shutdown the TT API
                    TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted);
                    TTAPI.Shutdown();

                    m_disposed = true;
                }
            }
        }
示例#2
0
 /// <summary>
 /// Clean up TTAPI objects
 /// </summary>
 public void Dispose()
 {
     lock (m_lock)
     {
         if (!m_disposed)
         {
             // Detach callbacks and dispose of all subscriptions
             if (m_req != null)
             {
                 m_req.Dispose();
                 m_req = null;
             }
             if (m_tsSub != null)
             {
                 m_tsSub.Dispose();
             }
             m_tsSub = null;
         }
         // Shutdown the Dispatcher
         if (m_disp != null)
         {
             m_disp.BeginInvokeShutdown();
             m_disp = null;
         }
         m_disposed = true;
     }
 }
示例#3
0
        /// <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;
                }
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    // Shutdown all subscriptions
                    if (req != null)
                    {
                        req.Dispose();
                        req = null;
                    }
                    if (ps != null)
                    {
                        ps.Dispose();
                        ps = null;
                    }

                    // Shutdown the Dispatcher
                    if (disp != null)
                    {
                        disp.BeginInvokeShutdown();
                        disp = null;
                    }

                    // Shutdown the TT API
                    if (apiInstance != null)
                    {
                        //TTAPI.ShutdownCompleted += new EventHandler();
                        TTAPI.Shutdown();
                        apiInstance = null;
                    }
                }
            }

            disposed = true;
        }