示例#1
0
        /// <summary>
        /// 验证绑定信息
        /// </summary>
        /// <returns></returns>
        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);
        }
示例#2
0
 /// <summary>
 /// 查看选中用户交换机Exchanges信息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 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("未发现该交换机");
     }
 }