private bool SaveSetting() { PublisherWrapper w = this.comboBoxPublisher.SelectedItem as PublisherWrapper; if (w == null) { return(false); } if (_cfgList != null) { foreach (PushChannelConfig cfg in _cfgList) { if (cfg == _channelConfig) { continue; } if (cfg.SenderEntityID == w.Publisher.EntityID) { MessageBox.Show(this, "Publisher \"" + w.Publisher.Name + "\" is already in the list.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.comboBoxPublisher.Focus(); return(false); } } } _channelConfig.SenderEntityID = w.Publisher.EntityID; _channelConfig.SenderEntityName = w.Publisher.Name; _channelConfig.ProtocolType = _protocolTypeCtrl.GetValue(); switch (_channelConfig.ProtocolType) { case ProtocolType.LPC: ChannelHelper.GenerateLPCChannel(_channelConfig); break; case ProtocolType.MSMQ: if (_needToGenerateURI) { ChannelHelper.GenerateMSMQChannel(_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.Subscription.Type = routType; if (routType == RoutingRuleType.MessageType) { _channelConfig.Subscription.MessageTypeList.Clear(); foreach (MessageType t in this.checkedListBoxMessageType.CheckedItems) { _channelConfig.Subscription.MessageTypeList.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 message content.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBoxXPath.Focus(); return(false); } _channelConfig.Subscription.MessageTypeList.Clear(); _channelConfig.Subscription.ContentCriteria.XPath = xpath; _channelConfig.Subscription.ContentCriteria.XPathPrefixDefinition = this.textBoxPrefix.Text.Trim(); _channelConfig.Subscription.ContentCriteria.RegularExpression = this.textBoxRegExp.Text; } return(true); }