/// <summary> /// 通过此方法,获得与服务器的连接。 /// </summary> public void connect()//建¨立ⅰ?连?接ó { logHelper = new TextLogHelper(label1, this, ip, port); _cedaSubscribe = new CedaManager(logHelper); _cedaSubscribe.OnCedaMessage += new Action <com.adaptiveMQ2.message.Message>(_cedaSubscribe_OnCedaMessage); ClientInfo clientInfo = new ClientInfo(); clientInfo.setAddress(ip, port); clientInfo.setUser("monitor", "monitor"); clientInfo.Protocol = ClientInfo.PROTOCOL_TCP; ThreadPool.QueueUserWorkItem(o => { _cedaSubscribe.Connect(clientInfo); labelControl19.Text = "等待连接.."; if (!_cedaSubscribe.IsConnected) { return; } if (_cedaSubscribe.IsConnected) { labelControl19.Text = "连接成功!"; List <string> topicList = new List <string>(); topicList.Add("monitor.count.user.all"); topicList.Add("monitor.count.user.clienttype"); topicList.Add("monitor.count.user.endtype"); topicList.Add("monitor.count.user.svraddr"); _cedaSubscribe.SubscribeWithImage(topicList, svrId, ""); labelControl19.Text = "连接成功!"; } }); }
public ZedgraphDemo(string name, ILog log) { InitializeComponent(); timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Enabled = true; timer.Interval = 2000; timer.Start(); graphPanel = base.GraphPane; RequestSvrId = name; graphPanel.Title.Text = "监控" + name; graphPanel.XAxis.Title.Text = "时间"; graphPanel.YAxis.Title.Text = "值"; graphPanel.XAxis.Type = AxisType.DateAsOrdinal; graphPanel.XAxis.Scale.Format = "HH:mm"; graphPanel.XAxis.MajorGrid.IsVisible = true; //珊格子 graphPanel.YAxis.MajorGrid.IsVisible = true; graphPanel.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, Color.ForestGreen), 45.0F); graphPanel.XAxis.Scale.Max = 300; graphPanel.YAxis.Scale.Min = 0; cedaClient = new CedaManager(log); cedaClient.OnCedaMessage += new Action <Message>(cedaClient_OnCedaMessage); this.Disposed += new EventHandler(ZedgraphDemo_Disposed); }
//当程序关闭时释放资源 private void Disconnect() { if (_cedaSubscribe != null) { _cedaSubscribe.Disconnect(); _cedaSubscribe.OnCedaMessage -= new Action <com.adaptiveMQ2.message.Message>(_cedaSubscribe_OnCedaMessage); _cedaSubscribe = null; } }
private void disconnect() { if (cedaManager != null) { cedaManager.Disconnect(); cedaManager.OnCedaMessage -= new Action <com.adaptiveMQ2.message.Message>(cedaManagaer_OnCedaMessage); cedaManager = null; } }
private void Disconnect() { if (_cedaSubscribe != null) { _cedaSubscribe.Disconnect(); _cedaSubscribe = null; } }
private void disconnect() { if (cedaClient != null) { cedaClient.Disconnect(); cedaClient.OnCedaMessage -= new Action <com.adaptiveMQ2.message.Message>(cedaClient_OnCedaMessage); cedaClient = null; timer.Enabled = false; } }
public void connect() { logHelper = new TextLogHelper(label5,this, IP, PORT); _cedaSubscribe = new CedaManager(logHelper); ClientInfo clientInfo = new ClientInfo(); clientInfo.setAddress(IP, PORT); clientInfo.setUser("monitor", "monitor"); clientInfo.Protocol = ClientInfo.PROTOCOL_TCP; ThreadPool.QueueUserWorkItem(o => { _cedaSubscribe.Connect(clientInfo); }); }
//连接服务器,并订阅目标消息 private void ConnectionServer() { //MessageBox.Show("kaishilianjie"); _cedaSubscribe = new CedaManager(logHelper); _cedaSubscribe.OnCedaMessage += new Action <com.adaptiveMQ2.message.Message>(_cedaSubscribe_OnCedaMessage); _clientInfo = new ClientInfo(); _clientInfo.setAddress(ip, port); _clientInfo.setUser("monitor", "monitor"); _clientInfo.Protocol = ClientInfo.PROTOCOL_TCP; //MessageBox.Show("启动线程,并订阅消息"); try { ThreadPool.QueueUserWorkItem(o => { _cedaSubscribe.Connect(_clientInfo); if (_cedaSubscribe == null) { return; } if (_cedaSubscribe.IsConnected) { string msgbody = MsgHelper.Serializer <Dictionary <string, object> >(dic); request.MessageBody.addString((short)3, msgbody); request.MessageBody.addString((short)4, "JSON"); request.MessageBody.addInt((short)5, 0); request.MessageBody.addString(7, DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); sentMsg(); _cedaSubscribe.Subscribe("monitor.event.*"); } }); } catch { txtMsg.Text = "连接失败,请检查链接。SerID:" + serId + " IP:" + ip + " PORT:" + port; } }
public AmountPlugin() { //坐标轴数据格式及标题定义 gp = base.GraphPane; gp.Title.Text = "交易耗时监控"; //标题 gp.XAxis.Title.Text = "时间"; //x轴标题 gp.YAxis.Title.Text = "交易耗时(/毫秒)"; //y轴标题 gp.XAxis.Type = AxisType.Date; //x轴定义为时间格式 gp.XAxis.Scale.Format = "HH:mm:ss"; //x轴时间格式化为HH:mm:ss gp.XAxis.MajorGrid.IsVisible = true; //x轴珊格子效果 gp.YAxis.MajorGrid.IsVisible = true; //y轴珊格子效果 gp.YAxis.Scale.Min = 0; //设置y轴最小值为0 gp.Chart.Border.IsVisible = false; //设置边框为无 gp.XAxis.MajorTic.IsOpposite = false; //设置X轴对面轴大间隔为无 gp.XAxis.MinorTic.IsOpposite = false; //设置X轴对面轴小间隔为无 gp.YAxis.MajorTic.IsOpposite = false; //Y轴对面轴大间隔为无 gp.YAxis.MinorTic.IsOpposite = false; //Y轴对面轴小间隔为无 refreshPane(); cedaManager = new CedaManager(logHelper); cedaManager.OnCedaMessage += new Action <Message>(cedaManagaer_OnCedaMessage); }
private void ConnectionServer() { _cedaSubscribe = new CedaManager(logHelper); _cedaSubscribe.OnCedaMessage += new Action <com.adaptiveMQ2.message.Message>(_cedaSubscribe_OnCedaMessage); _clientInfo = new ClientInfo(); _clientInfo.setAddress(ip, port); _clientInfo.setUser("monitor", "monitor"); _clientInfo.Protocol = ClientInfo.PROTOCOL_TCP; ThreadPool.QueueUserWorkItem(o => { _cedaSubscribe.Connect(_clientInfo); if (_cedaSubscribe == null) { return; } if (_cedaSubscribe.IsConnected) { _cedaSubscribe.Subscribe("YM.MONITOR"); } }); }
//SoundPlayer warnSoundPlayer = new SoundPlayer(); public SRControl() { InitializeComponent(); ToolStripMenuItem btnSave = new ToolStripMenuItem(); btnSave.Text = "保存布局"; btnSave.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; btnSave.Click += new EventHandler(btnSave_Click); ToolStripMenuItem btnDelete = new ToolStripMenuItem(); btnDelete.Text = "删除布局"; btnDelete.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; btnDelete.Click += new EventHandler(btnDelete_Click); ToolStripMenuItem btnClear = new ToolStripMenuItem(); btnClear.Text = "清除警告信息"; btnClear.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; btnClear.Click += new EventHandler(btnClear_Click); contextMenuStrip.Items.Add(btnSave); contextMenuStrip.Items.Add(btnDelete); contextMenuStrip.Items.Add(new ToolStripSeparator()); contextMenuStrip.Items.Add(btnClear); this.Disposed += new EventHandler(SRControl_Disposed); goView1.NewLinkPrototype = new AnimatedLink(); this.goView1.NewLinkClass = typeof(AnimatedLink); StateChartDocument filedoc = StateChartDocument.LoadXml(loc); if (filedoc == null) { filedoc = new StateChartDocument(); GoComment com = StateChartDocument.NewComment(); com.Width = this.Width; com.Visible = false; filedoc.Add(com); } else { isLoad = true; } GoDocument doc = filedoc; this.goView1.Document = doc; goView1.ObjectDoubleClicked += new GoObjectEventHandler(goView1_ObjectDoubleClicked); goView1.Document.UndoManager = new GoUndoManager(); logHelper = new TextLogHelper(label1, this, ip, port); logHelper.SRControl = this; _cedaSubscribe = new CedaManager(logHelper); timer1 = new Timer(); this.timer1.Interval = 50; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); //setTimeEnable(true); //_cedaSubscribe.SRControl = this; //warnSoundPlayer.SoundLocation = Consts.SoundLocation; device = new DeviceImpl(); device.init(this, Microsoft.DirectX.DirectSound.CooperativeLevel.Priority); }