コード例 #1
0
 public wxMessageReceiveSvr(WebInterfaceClass w, frm_planMonitor frm)
 {
     wif     = w;
     Monitor = frm;
     InitializeComponent();
     if (Program.plancolls == null)
     {
         Program.plancolls = new ShareLotteryPlanCollection();
     }
     //Program.wif.MsgProcessCompleted += refreshMsg;
     //Action<object, List<wxMessageClass>> handle = new Action<object, List<wxMessageClass>>(Program.plancolls.MsgProcess.RefreshMsg);
     //Program.wif.MsgProcessCompleted_ForExtralInterfaceInvoke(handle);
     try
     {
         Program.plancolls.MsgProcess.SendMsg          += wif.SendMsg;
         Program.plancolls.MsgProcess.SendImgMsg       += wif.SendImgMsg;
         Program.plancolls.MsgProcess.SendUrlImgMsg    += wif.SendUrlImgMsg;
         Program.plancolls.MsgProcess.SharePlanChanged += Monitor.refreshTab;
         Program.plancolls.MsgProcess.RobotUnionId      = wif.UnionId;
         Program.plancolls.MsgProcess.RobotNikeName     = wif.UserNike;
         Program.plancolls.MsgProcess.RobotUserName     = wif.UserName;
         Program.plancolls.MsgProcess.MsgChanged       += Monitor.refreshMsg;
         recTimer = new Timer(ReceiveMsg, null, 0, TimerInterval);
     }
     catch (Exception e)
     {
     }
 }
コード例 #2
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                frm_planMonitor frm = new frm_planMonitor();
                Heart_Timer          = new Timer();
                Heart_Timer.Interval = Heart_minutes * 60 * 1000;
                Heart_Timer.Enabled  = true;

                Heart_Timer.Tick += Heart_Timer_Tick;
                string strclassname = typeof(WebInterfaceClass).Name.Split('\'')[0];
                string url          = string.Format("ipc://IPC_{0}/{1}", "wxmsg", strclassname);
                //LogableClass.ToLog("监控终端", "刷新数据", url);
                //_UseSetting = wc.GetServerObject<ServiceSetting<TimeSerialData>>(url);
                WinComminuteClass comm = new WinComminuteClass();
                wif = comm.GetServerObject <WebInterfaceClass>(url, false);
                Heart_Timer.Start();
                Heart_Timer_Tick(null, null);
                wxMessageReceiveSvr svr = new wxMessageReceiveSvr(wif, frm);
                //svr.Monitor = new frm_planMonitor();
                //svr.wif = wif;
                svr.Start();



                Application.Run(svr.Monitor);
            }
            catch (Exception ce)
            {
                MessageBox.Show(string.Format("{0}:{1}", ce.Message, ce.StackTrace));
                return;
            }
            finally
            {
                Heart_Timer.Stop();
                wif = null;
            }
        }