Example #1
0
        private void RefreshMessageType()
        {
            this.checkedListBoxMessageType.Items.Clear();

            ResponserWrapper w = this.comboBoxResponser.SelectedItem as ResponserWrapper;

            if (w == null)
            {
                return;
            }

            foreach (MessageTypePair t in w.Responser.ResponseDescription.MessageTypePairList)
            {
                this.checkedListBoxMessageType.Items.Add(t);
            }
        }
Example #2
0
        private bool SaveSetting()
        {
            ResponserWrapper w = this.comboBoxResponser.SelectedItem as ResponserWrapper;

            if (w == null)
            {
                return(false);
            }

            if (_cfgList != null)
            {
                foreach (PullChannelConfig cfg in _cfgList)
                {
                    if (cfg == _channelConfig)
                    {
                        continue;
                    }
                    if (cfg.ReceiverEntityID == w.Responser.EntityID)
                    {
                        MessageBox.Show(this, "Responser \"" + w.Responser.Name + "\" is already in the list.",
                                        this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.comboBoxResponser.Focus();
                        return(false);
                    }
                }
            }

            _channelConfig.ReceiverEntityID   = w.Responser.EntityID;
            _channelConfig.ReceiverEntityName = w.Responser.Name;

            _channelConfig.ProtocolType = _protocolTypeCtrl.GetValue();
            switch (_channelConfig.ProtocolType)
            {
            case ProtocolType.LPC:
                ChannelHelper.GenerateLPCChannel(_channelConfig);
                break;

            case ProtocolType.RPC_NamedPipe:
                if (_needToGenerateURI)
                {
                    ChannelHelper.GenerateWCFNamedPipeChannel(_channelConfig);
                }
                break;

            case ProtocolType.RPC_SOAP:
                if (_needToGenerateURI)
                {
                    ChannelHelper.GenerateWCFSoapChannel(_channelConfig);
                }
                break;

            case ProtocolType.RPC_TCP:
                if (_needToGenerateURI)
                {
                    ChannelHelper.GenerateWCFTcpChannel(_channelConfig);
                }
                break;

            default:
                MessageBox.Show(this, "Following protocol type is not supported by now.\r\n\r\n"
                                + this.comboBoxProtocolType.Text, this.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.comboBoxProtocolType.Focus();
                return(false);
            }

            RoutingRuleType routType = _routTypeCtrl.GetValue();

            _channelConfig.RequestContract.Type = routType;
            if (routType == RoutingRuleType.MessageType)
            {
                _channelConfig.RequestContract.MessageTypePairs.Clear();
                foreach (MessageTypePair t in this.checkedListBoxMessageType.CheckedItems)
                {
                    _channelConfig.RequestContract.MessageTypePairs.Add(t);
                }
            }
            else if (routType == RoutingRuleType.ContentBased)
            {
                string xpath = this.textBoxXPath.Text.Trim();

                if (xpath == null || xpath.Length < 1)
                {
                    MessageBox.Show(this, "Please input the XPath to access the requesting message content.",
                                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.textBoxXPath.Focus();
                    return(false);
                }

                _channelConfig.RequestContract.MessageTypeList.Clear();
                _channelConfig.RequestContract.ContentCriteria.XPath = xpath;
                _channelConfig.RequestContract.ContentCriteria.XPathPrefixDefinition = this.textBoxPrefix.Text.Trim();
                _channelConfig.RequestContract.ContentCriteria.RegularExpression     = this.textBoxRegExp.Text;
            }

            return(true);
        }