/// <summary>
        /// Отправить сообщение.
        /// </summary>
        /// <param name="message">Сообщение.</param>
        protected override void OnSendInMessage(Message message)
        {
            switch (message.Type)
            {
            case MessageTypes.Reset:
            {
                if (_api != null)
                {
                    try
                    {
                        if (_api.IsConnected)
                        {
                            _api.Disconnect();
                        }
                    }
                    catch (Exception ex)
                    {
                        SendOutError(ex);
                    }

                    try
                    {
                        _api.Dispose();
                    }
                    catch (Exception ex)
                    {
                        SendOutError(ex);
                    }

                    _api = null;
                }

                SendOutMessage(new ResetMessage());

                break;
            }

            case MessageTypes.Connect:
            {
                var terminal = GetTerminal();

                if (!terminal.IsLaunched)
                {
                    terminal.AssignProcess();
                }

                Api.Connect(terminal.DirectoryName);

                break;
            }

            case MessageTypes.Disconnect:
                Api.Disconnect();
                break;

            case MessageTypes.OrderRegister:
                var regMsg = (OrderRegisterMessage)message;
                RegisterTransaction(regMsg.CreateRegisterTransaction(regMsg.GetValue <string>(PositionChangeTypes.DepoName), SecurityClassInfo, SingleSlash));
                break;

            case MessageTypes.OrderReplace:
                RegisterTransaction(((OrderReplaceMessage)message).CreateMoveTransaction(SecurityClassInfo));
                break;

            case MessageTypes.OrderCancel:
                RegisterTransaction(((OrderCancelMessage)message).CreateCancelTransaction(SecurityClassInfo));
                break;

            case MessageTypes.OrderGroupCancel:
                RegisterTransaction(((OrderGroupCancelMessage)message).CreateCancelFuturesTransaction(SecurityClassInfo));
                break;
            }
        }