void onConsumerListener(IMessage message) { ITextMessage msg = (ITextMessage)message; //异步调用下,否则无法回归主线程 log4net.WriteLogFile(msg.Text); String cStr = msg.Text; ActiveMQ_Message vMessage = JsonLib.ToObject <ActiveMQ_Message>(cStr); Change(vMessage); }
private void button2_Click(object sender, EventArgs e) { ActiveMQ_Producer vMQ = ActiveMQ_Producer.getInstance(); String cUserID = AppManager.getIPAddr(); ActiveMQ_Message vMessage = new ActiveMQ_Message(); vMessage.FROM_ID = cUserID + "B"; vMessage.USER_ID = cUserID + "C"; vMessage.MESSAGE = "中国您好!"; vMessage.CMD_ID = 12; vMQ.SendMSG(vMessage.FROM_ID, vMessage.USER_ID, vMessage); }
private void Change(ActiveMQ_Message vMessage) { if (vMessage.CMD_ID == 11) { String cFormTitle = "国土智能监控取证系统"; IntPtr hWnd = WinAPI.FindWindow(null, cFormTitle); if (hWnd != IntPtr.Zero) { COPYDATASTRUCT cds = new COPYDATASTRUCT(); cds.lpData = vMessage.MESSAGE; WinAPI.PostMessage(hWnd, WinAPI.WM_USER + 1001, 0, ref cds); } else { try { String cFileName = Application.StartupPath + "\\GTWS_AI.exe"; if (File.Exists(cFileName)) { System.Diagnostics.Process.Start(cFileName); } } catch (Exception ex) { log4net.WriteLogFile(ex.Message, LogType.ERROR); } } } else if (vMessage.CMD_ID == 12) { String cFormTitle = "国土智能监控取证系统"; IntPtr hWnd = WinAPI.FindWindow(null, cFormTitle); if (hWnd != IntPtr.Zero) { WinAPI.PostMessage(hWnd, WinAPI.WM_CLOSE, 0, 0); } } else { log4net.WriteLogFile(string.Format(@"接收到:{0}{1}", vMessage.FROM_ID + "," + vMessage.USER_ID + "," + vMessage.MESSAGE, Environment.NewLine), LogType.ERROR); } }
protected void Page_Load(object sender, EventArgs e) { CheckLogin(); ID = StringEx.getString(Request.QueryString["ID"]); LoginUserInfo vUserInfo = getLoginUserInfo(); String cUSER_ID = vUserInfo.USER_ID; String cORG_ID = vUserInfo.ORG_ID; String cDayTime = StringEx.getString(DateUtils.getDayTimeNum()); String cKeyID = cUSER_ID + "@" + cORG_ID + "@" + cDayTime + "@" + ID; String cKeyMD = Base64.StrToBase64(cKeyID); ActiveMQ_Message vMessage = new ActiveMQ_Message(); vMessage.CMD_ID = ActiveMQ_MessageType.VIDEO_LIVE; Dictionary <string, string> voConf = new Dictionary <string, string>(); voConf.Add("ID", ID); voConf.Add("ORG_ID", cORG_ID); voConf.Add("USER_ID", cUSER_ID); voConf.Add("DAYTIME", cDayTime); ID = cKeyMD; vMessage.MESSAGE = JsonLib.ToJSON(voConf); //ActiveMQ_Producer.SendMessage(cORG_ID, cUSER_ID, vMessage); }