Esempio n. 1
0
 /// <summary>
 /// Releases the controller
 /// </summary>
 public void release()
 {
     if (mTradingSession != null)
     {
         mTradingSession.unsubscribeResponse(this);
         mTradingSession.unsubscribeSessionStatus(this);
         // terminate the trading session
         mTradingSession.logout();
         // wait while it is finished
         // NOTE: in a real application use event listener for the session statuses to avoid this locking loop
         while (mTradingSession.getSessionStatus() != O2GSessionStatusCode.Disconnected)
         {
             Thread.Sleep(100);
         }
         // finalize commnicator and dispose session
         mPriceHistoryCommunicator.removeStatusListener(this);
         mPriceHistoryCommunicator.removeListener(this);
         mPriceHistoryCommunicator = null;
         mTradingSession           = null;
     }
 }