예제 #1
0
 private void UpdateUI(DataCatchLog log, object msg)
 {
     //异步更新UI
     this.Invoke(new AsynUpdateUI((newMsg) =>
     {
         log.SendMessage(string.Format("{0} {1} {2}", DateTime.Now.ToLongDateString(), DateTime.Now.ToLongTimeString(), newMsg));
     }), msg);
 }
예제 #2
0
        private void GetBill(string touid, bool isDemo, object obj)
        {
            try
            {
                HTTPRequestHeaders header = (HTTPRequestHeaders)obj;
                string             cookie = header["Cookie"];
                string             user   = DataCatchRequest.GetUser(cookie);
                string             key    = string.Format("{0}&{1}", user, touid);
                CacthConfig        config = new CacthConfig(string.Format("{0}GetBillBeginValue", analysisUrl))
                {
                    Cookies = cookie
                };
                //if (!CacthConfig.CatchDic.TryGetValue(key, out config))
                //{
                //    config = new CacthConfig(string.Format("{0}GetBillBeginValue", analysisUrl)) { Cookies = cookie };
                //    CacthConfig.CatchDic.Add(key, config);
                //}
                //config.NewCookies = cookie;

                DataCatchLog log = GetCatchLog(user, isDemo, config);
                log.SetToUser(touid);
                AnsyNet.AnsyDataCatch(config, (tuser, msg) =>
                {
                    if (!string.IsNullOrEmpty(msg.Message))
                    {
                        UpdateUI(log, msg.Message);
                    }
                    switch (msg.Action)
                    {
                    case ActionType.SendRequestData:
                        log.EmitPostDataRequestMsg((IList)msg.Data);
                        break;
                    }
                    return(msg);
                });
            }
            catch (Exception e)
            {
                this.Invoke(new AsynUpdateUI((sn) =>
                {
                    this.textBox1.Text = sn.ToString();
                }), e.Message);
            }
        }
예제 #3
0
        private DataCatchLog GetCatchLog(string user, bool isDemo, CacthConfig config)
        {
            string       tempUrl = string.Format("{0}{1}", analysisUrl, isDemo?"BillCatchDemo":"BillCatch");
            DataCatchLog log;

            if (!logWindows.TryGetValue(config, out log))
            {
                log = new DataCatchLog(user, socketUrl, tempUrl);
                //logWindows.Add(config, log);
            }
            if (log.IsDisposed)
            {
                logWindows.Remove(config);
                log = new DataCatchLog(user, socketUrl, tempUrl);
                logWindows.Add(config, log);
            }
            log.Show();
            return(log);
        }