private bool CheckBind() { bool checkResult = false; if (string.IsNullOrWhiteSpace(txtSelectExchange.Text)) { ShowSysMessage("未选择交换机"); } else if (string.IsNullOrWhiteSpace(txtSelectQueue.Text)) { ShowSysMessage("未选择队列"); } else { exchange = userExchanges.FirstOrDefault(x => x.name == txtSelectExchange.Text); queue = queues.FirstOrDefault(x => x.name == txtSelectQueue.Text); if (exchange == null) { ShowSysMessage("交换机不存在"); } else if (queue == null) { ShowSysMessage("队列不存在"); } else { checkResult = true; } } return(checkResult); }
private void btnExchange_Click(object sender, EventArgs e) { if (lbUserExchanges.SelectedItem == null) { return; } exchange = userExchanges.FirstOrDefault(x => x.name == lbUserExchanges.SelectedItem.ToString()); txtSysMessage.Clear(); if (exchange != null) { if (exchange.message_stats == null) { exchange.message_stats = new MessageStatsEntity(); } ShowSysMessage(string.Format("Name:{0},\r\nType:{1},Durable:{2},Auto_delete:{3},Internal:{4},Publish_in:{5},Publish_out:{6}\r\n", exchange.name, exchange.type, exchange.durable, exchange.auto_delete, exchange.internalFlag, exchange.message_stats.publish_in, exchange.message_stats.publish_out)); } else { ShowSysMessage("未发现该交换机"); } }