private void showQRImage()
{
var url = String.Format("https://login.weixin.qq.com/qrcode/" + uuid + "?t=webwx&_={0}", get_timestamp());
Console.WriteLine(url);
tip = 1;
WebRequest request = WebRequest.Create(url);
request.Method = "GET";
updateUITextLine(info_display, "正在读取二维码,请稍等……", Environment.NewLine, Color.Black);
using (WebResponse response = request.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
Image image = Image.FromStream(stream); // should catch timeout exception
qrcode_img.Invoke(new Action( ()=>
{
qrcode_img.Image = image;
qrcode_img.Height = image.Height;
qrcode_img.Width = image.Width;
}));
start_btn.Invoke(new Action( ()=>
{
this.Controls.Remove(start_btn);
start_btn.Dispose();
}));
updateUITextLine(info_display, "请使用微信扫描二维码以登录", Environment.NewLine, Color.Black);
}
}
}