Exemplo n.º 1
0
        private void JDTypesProcess()
        {
            //http://list.jd.com/list.html?cat=9987,653,655
            string wareCat = string.Format("{0},{1},{2}", cmbMainType.EditValue, cmbSubType.EditValue, cmbLastType.EditValue);
            string kType   = cmbTypes.EditValue.ToString();

            JDKiller.GetInstance().InitProcess = InitTypesProgress;
            JDKiller.GetInstance().ShowStep    = ShowTypesStep;
            JDKiller.GetInstance().ShowMessage = ShowTypeMessage;
            JDKiller.GetInstance().EndProcess  = EndTypesProgress;

            JDKiller.GetInstance().GetWareTypeData(wareCat, kType);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取京东关注商品
        /// </summary>
        private void GetJDWatchWare()
        {
            string uName = txtUser.Text;
            string uPass = txtPass.Text;

            if (!string.IsNullOrEmpty(uName) && !string.IsNullOrEmpty(uPass))
            {
                JDKiller.GetInstance().InitLogin(uName, uPass);
                //判断是否需要验证码
                if (JDKiller.GetInstance().IsAuthcode)
                {
                    ShwoAuthCodeBox(JDKiller.GetInstance().ImageAuthCode);
                    return;
                }
                LoginAndGetWatch("");
            }
            else
            {
                MessageBox.Show("请检查用户名或密码是否正常输入!", "系统提示");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 获取关注商品线程
 /// </summary>
 private void GetWatchWares()
 {
     try
     {
         //优化
         //在关注数据很多时,会造成页面卡死现象;使用多线程+进度条方案进行优化
         List <WebSiteModel> iesites = JDKiller.GetInstance().GetWatchList();
         if (iesites != null && iesites.Count > 0)
         {
             UpdateWareChkBox(iesites);
         }
         else
         {
             MessageBox.Show("未获取到当前用户关注商品!" + ImportThreads.LastMsg, "系统提示");
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 登录京东并获取关注数据
        /// </summary>
        /// <param name="authcode"></param>
        private void LoginAndGetWatch(string authcode)
        {
            //注册委托时间
            JDKiller.GetInstance().ShowMessage = new Action <string>(ShowMessage);
            JDKiller.GetInstance().InitProcess = new Action <int>(InitProcess2);
            JDKiller.GetInstance().ShowStep    = new Action <int>(ShowGetStep);
            JDKiller.GetInstance().EndProcess  = new Action <bool>(EndGetProcess);

            if (JDKiller.GetInstance().Login4JD(authcode))
            {
                //InitProcess2();
                Thread watchThread = new Thread(GetWatchWares)
                {
                    Name = "watchThread", IsBackground = true
                };
                watchThread.Start();
            }
            else
            {
                MessageBox.Show("登录失败!" + ImportThreads.LastMsg);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 重载验证码图片
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void picAuthcode_DoubleClick(object sender, EventArgs e)
 {
     JDKiller.GetInstance().ReGetAuthCode();
     ShwoAuthCodeBox(JDKiller.GetInstance().ImageAuthCode);
 }