Exemplo n.º 1
0
        private void Dispose()
        {
            try
            {
                if (AstsServer != null && AstsServer.IsConnected)
                {
                    AstsServer.Disconnect();
                }
            }
            catch (Exception error)
            {
                SendLogMessage(error.ToString(), LogMessageType.Error);
            }

            if (AstsServer != null)
            {
                AstsServer.ConnectedEvent          -= Connected;
                AstsServer.DisconnectedEvent       -= Disconnected;
                AstsServer.NewSecurityEvent        -= NewSecurityEvent;
                AstsServer.PortfolioUpdateEvent    -= AddPortfolio;
                AstsServer.NewTradesEvent          -= NewTradesEvent;
                AstsServer.NewMyTradeEvent         -= AddMyTrade;
                AstsServer.MarketDepthUpdateEvent  -= UpdateBidAsk;
                AstsServer.OrderUpdateEvent        -= UpdateOrder;
                AstsServer.OrderFailedEvent        -= OrderFailedEvent;
                AstsServer.SecurityMoexUpdateEvent -= LevelOneUpdateEvent;
            }

            AstsServer = null;

            _getPortfoliosAndSecurities = false;
        }
Exemplo n.º 2
0
 /// <summary>
 /// приостановить подключение
 /// </summary>
 private void Disconnect()
 {
     AstsServer.Disconnect();
     Thread.Sleep(5000);
 }