/// <summary>
        ///
        /// </summary>
        public void Dispose()
        {
            lock (this)
            {
                if (_orders != null)
                {
                    _orders.UnInitialize();
                    _orders.Dispose();
                    _orders = null;
                }

                if (_adapter != null)
                {
                    _adapter = null;
                }

                if (_core != null)
                {
                    _desk = null;
                    _core = null;
                }

                if (_messageLoopOperator != null)
                {
                    _messageLoopOperator.Stop();
                    _messageLoopOperator.Dispose();
                    _messageLoopOperator = null;
                }

                ChangeOperationalState(OperationalStateEnum.Disposed);
            }

            //GC.Collect();
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        public void Dispose()
        {
            try
            {
                lock (this)
                {
                    if (_quotes != null)
                    {
                        _quotes.Dispose();
                        _quotes = null;
                    }

                    if (_history != null)
                    {
                        _history.Dispose();
                        _history = null;
                    }

                    if (_orders != null)
                    {
                        _orders.UnInitialize();
                        _orders.Dispose();
                        _orders = null;
                    }

                    if (_adapter != null)
                    {
                        _adapter = null;
                    }

                    if (_communicationManager != null)
                    {
                        _communicationManager.OnLogonSucceed -= new IMbtComMgrEvents_OnLogonSucceedEventHandler(_communicationManager_OnLogonSucceed);
                        _communicationManager = null;
                    }

                    if (_messageLoopOperator != null)
                    {
                        _messageLoopOperator.Stop();
                        _messageLoopOperator.Dispose();
                        _messageLoopOperator = null;
                    }

                    ChangeOperationalState(OperationalStateEnum.Disposed);
                }
            }
            catch (Exception ex)
            {
                SystemMonitor.OperationError(ex.Message);
            }

            //GC.Collect();
        }
        /// <summary>
        ///
        /// </summary>
        public void Dispose()
        {
            lock (this)
            {
                //if (_quotes != null)
                //{
                //    _quotes.Dispose();
                //    _quotes = null;
                //}

                //if (_history != null)
                //{
                //    _history.Dispose();
                //    _history = null;
                //}

                //if (_orders != null)
                //{
                //    _orders.UnInitialize();
                //    _orders.Dispose();
                //    _orders = null;
                //}

                //if (_adapter != null)
                //{
                //    _adapter = null;
                //}

                if (_communicationManager != null)
                {
                    //_communicationManager.OnLogonSucceed -= new IMbtComMgrEvents_OnLogonSucceedEventHandler(_communicationManager_OnLogonSucceed);
                    _communicationManager = null;
                }

                if (_messageLoopOperator != null)
                {
                    _messageLoopOperator.Stop();
                    _messageLoopOperator.Dispose();
                    _messageLoopOperator = null;
                }

                ChangeOperationalState(OperationalStateEnum.Disposed);
            }

            //GC.Collect();
        }
        /// <summary>
        ///
        /// </summary>
        public void Dispose()
        {
            ChangeOperationalState(OperationalStateEnum.Disposed);

            _desk = null;
            _core = null;
            _tradeDeskEventsSink = null;

            BackgroundMessageLoopOperator messageLoopOperator = _messageLoopOperator;

            if (messageLoopOperator != null)
            {
                messageLoopOperator.Stop();
                messageLoopOperator.Dispose();
            }

            _messageLoopOperator = null;

            GC.Collect();
        }