Ejemplo n.º 1
0
        private void LoadVc()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    imgVc.Image = Images.VcLoding;
                }));
            }
            else
            {
                imgVc.Image = Images.VcLoding;
            }
            Thread t = new Thread(() =>
            {
                string code = string.Empty;
                Image img   = VcHelper.GetVcImage(StaticValues.OrderVcUrl, ref code, ref StaticValues.MyCookies, ti.Token);
                if (this.InvokeRequired)
                {
                    this.BeginInvoke(new MethodInvoker(delegate()
                    {
                        txtVc.Text  = code;
                        imgVc.Image = img;
                    }));
                }
                else
                {
                    txtVc.Text  = code;
                    imgVc.Image = img;
                }
            });

            t.IsBackground = true;
            t.Start();
        }
Ejemplo n.º 2
0
        private void LoadVc()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    imgVc.Image       = Images.VcLoding;
                    toolStripMsg.Text = "正在加载验证码...";
                }));
            }
            else
            {
                imgVc.Image       = Images.VcLoding;
                toolStripMsg.Text = "正在加载验证码...";
            }
            Thread t = new Thread(() =>
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
                string code = string.Empty;
                Image img   = VcHelper.GetVcImage(StaticValues.LoginVcUrl, ref code, ref StaticValues.MyCookies);
                sw.Stop();
                this.BeginInvoke(new MethodInvoker(delegate() {
                    txtVc.Text        = code;
                    imgVc.Image       = img;
                    toolStripMsg.Text = "验证码加载成功,耗时:" + sw.ElapsedMilliseconds + "ms";
                }));
            });

            t.IsBackground = true;
            t.Start();
        }
Ejemplo n.º 3
0
        public void ShowVc()
        {
            Thread thread = new Thread(() =>
            {
                string code = string.Empty;
                var img     = VcHelper.GetVcImage(StaticValues.OrderVcUrl, ref code, ref StaticValues.MyCookies, token);
                if (this.InvokeRequired)
                {
                    this.BeginInvoke(new MethodInvoker(delegate()
                    {
                        this.imgVc.Image = img;
                        if (code.Length == 4)
                        {
                            txtVc.Text = code;
                        }
                        else
                        {
                            txtVc.Text = "";
                        }
                    }));
                }
                else
                {
                    this.imgVc.Image = img;
                    if (code.Length == 4)
                    {
                        txtVc.Text = code;
                    }
                    else
                    {
                        txtVc.Text = "";
                    }
                }
            });

            thread.IsBackground = true;
            thread.Start();
        }