private void DispatchMsg(MessageData msgdata)
        {
            ICommunicationHandler handler;
            switch (msgdata.TragetPlatform)
            {
                case PlatformType.Encrypt:
                    handler = new EncryptCommunicationHandler();
                    break;
                case PlatformType.Core:
                default:
                    handler = new CoreCommunicationHandler();
                    break;
            }

            if (_dispatchMsg != null)
            {

                lock (_dispatchMsg)
                {
                    _dispatchMsg.MsgHandler = handler;
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
            else
            {
                _dispatchMsg = new MsgDispatchEAP(handler);
                lock (_dispatchMsg)
                {
                    _dispatchMsg.DispatchCompleted += new DispatchCompletedEventHandler(DispatchMsg_DispatchCompleted);
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
        }
        private void DispatchMsg(MessageData msgdata)
        {
            try
            {
                ICommunicationHandler handler;
                switch (msgdata.TragetPlatform)
                {
                    case PlatformType.Encrypt:
                        handler = new EncryptCommunicationHandler();
                        break;
                    case PlatformType.Payment:
                    case PlatformType.PaymentDownload:
                        handler = new PayCommunicationHandler();
                        break;
                    case PlatformType.Core:
                    default:
                        handler = new CoreCommunicationHandler();
                        break;
                }

                if (_dispatchMsg != null)
                {

                    lock (_dispatchMsg)
                    {
                        _dispatchMsg.MsgHandler = handler;
                        _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                    }
                }
                else
                {
                    _dispatchMsg = new MsgDispatchEAP(handler);
                    lock (_dispatchMsg)
                    {
                        _dispatchMsg.DispatchCompleted += new DispatchCompletedEventHandler(DispatchMsg_DispatchCompleted);
                        _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
        private void DispatchMsg(MessageData msgdata)
        {
            ICommunicationHandler handler;
            switch (msgdata.TragetPlatform)
            {
                case PlatformType.Encrypt:
                    handler = new EncryptCommunicationHandler();
                    break;
                case PlatformType.Payment:
                case PlatformType.PaymentDownload:
                    handler = new PayCommunicationHandler();
                    break;
                case PlatformType.Core:
                    handler = new CoreCommunicationHandler();
                    break;
                case PlatformType.FingerMarks:
                    handler = new MarkComminicationHandler();
                    break;
                default:
                    handler = new NullableHandler();
                    break;
                    
            }

            AidLogHelper.Write(xQuant.Log4.LogLevel.Debug, "开始分发(MQHandlerSync),GUID=" + msgdata.MessageID);
            if (_dispatchMsg != null)
            {
                lock (_dispatchMsg)
                {
                    _dispatchMsg.MsgHandler = handler;
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
            else
            {
                _dispatchMsg = new MsgDispatchEAP(handler);
                lock (_dispatchMsg)
                {
                    _dispatchMsg.DispatchCompleted += new DispatchCompletedEventHandler(DispatchMsg_DispatchCompleted);
                    _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                }
            }
            AidLogHelper.Write(xQuant.Log4.LogLevel.Debug, "分发结束(MQHandlerSync),GUID="+ msgdata.MessageID);
        }
        private void DispatchMsg(MessageData msgdata)
        {
            _isAsyncSocket = checkBoxAsyncSock.Checked;
            if (_isAsyncSocket)
            {
                OnMessageHandleAsync(msgdata);
            }
            else
            {
                ICommunicationHandler handler;
                switch (msgdata.TragetPlatform)
                {
                    case PlatformType.Payment:
                    case PlatformType.PaymentDownload:
                        handler = new PayCommunicationHandler();
                        break;
                    case PlatformType.Encrypt:
                        handler = new EncryptCommunicationHandler();
                        break;
                    case PlatformType.FingerMarks:
                        handler = new MarkComminicationHandler();
                        break;
                    case PlatformType.Core:
                    default:
                        handler = new CoreCommunicationHandler();
                        break;
                }

                if (_dispatchMsg != null)
                {
                    lock (_dispatchMsg)
                    {
                        _dispatchMsg.MsgHandler = handler;
                        _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                    }
                }
                else
                {
                    _dispatchMsg = new MsgDispatchEAP(handler);
                    lock (_dispatchMsg)
                    {
                        _dispatchMsg.DispatchCompleted += new DispatchCompletedEventHandler(DispatchMsg_DispatchCompleted);
                        _dispatchMsg.OnDispatchMsgAsync(msgdata, msgdata.MessageID);
                    }
                }
            }
        }