Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            JingDong  jd  = new JingDong();
            TaoBao    tb  = new TaoBao();
            PinDuoDuo pdd = new PinDuoDuo();

            jd.SetData  += GetData;//注册委托事件,需要回调的时候才注册
            tb.SetData  += GetData;
            pdd.SetData += GetData;

            TaskModel taskModel1 = new TaskModel();
            TaskModel taskModel2 = new TaskModel();
            TaskModel taskModel3 = new TaskModel();

            taskModel1._CTS = new System.Threading.CancellationTokenSource();
            taskModel2._CTS = new System.Threading.CancellationTokenSource();
            taskModel3._CTS = new System.Threading.CancellationTokenSource();

            taskModel1._Task = new Task(() => { jd.Collect(taskModel1._CTS); });
            taskModel2._Task = new Task(() => { tb.Collect(taskModel2._CTS); });
            taskModel3._Task = new Task(() => { pdd.Collect(taskModel3._CTS); });


            dict.Add("京东", taskModel1);
            dict.Add("淘宝", taskModel2);
            dict.Add("拼多多", taskModel3);
        }
Exemple #2
0
 // 京东Key
 private void button_JingDongKeyTest_Click(object sender, EventArgs e)
 {
     try
     {
         JingDong.GeneralBasic(Properties.Resources.OCR测试图片, textBox_JingDongAk.Text, textBox_JingDongSk.Text);
         MessageBox.Show("测试成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }