//获取坐席信息 private void GetSeat() { submitAction.BeginGetSeat((str) => { if (str == "获取信息失败" || str == string.Empty) { MessageBox.Show("信息获取失败,请重试", "获取坐席信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (str != "" && str.IndexOf("没有足够的票") > -1) { DetermineCall(() => { StopSubmit("订票失败,这事不赖我~~因为已经没有足够的票了"); }); return; } string result = str; string waitCount = ""; if (Regex.Match(result, "(?<=\"waitCount\":)[\\-]?\\d{1,}(?=,\")").ToString() == "0") { DetermineCall(() => { _orderNo = Regex.Match(result, "(?<=\"orderId\":\")[A-Z]\\d{9}(?=\",\")").ToString(); if (_orderNo != "" && flag == 0) { flag++; timer2.Enabled = false; lblState1.Text = "订票成功~~!订单号为:" + _orderNo; string path = System.IO.Directory.GetCurrentDirectory() + "\\Sound_Sucessed.wav"; if (System.IO.File.Exists(path)) { sp = new System.Media.SoundPlayer(path); sp.Play(); } if (MessageBox.Show("订票成功,赶紧到网站上支付吧~~", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { if (chkOpenIE.Checked) { OpenIE_API.OpenIE(_cookieContainer); } this.Close(); } } }); } else { DetermineCall(() => { waitCount = Regex.Match(result, "(?<=\"waitCount\":)[\\-]?\\d{1,}(?=,\")").ToString(); lblState1.Text = "据说前面还有 " + waitCount + " 个人,估计还需要等上 " + Regex.Match(result, "(?<=\"waitTime\":)[\\-]?\\d{1,}(?=,\")").ToString() + " 秒"; Application.DoEvents(); }); } }, _cookieContainer); }
private void picSupport_Click(object sender, EventArgs e) { OpenIE_API.OpenUrl("https://me.alipay.com/stupidscat"); }
private void tsbtnHome_Click(object sender, EventArgs e) { OpenIE_API.OpenUrl(Properties.Resources.AuthorHomePage); }
private void tsbtnAdvice_Click(object sender, EventArgs e) { OpenIE_API.OpenUrl(Properties.Resources.Advice); }
private void tsbtnDeveloper_Click(object sender, EventArgs e) { OpenIE_API.OpenUrl(Properties.Resources.Developer); }
private void tsbtnBug_Click(object sender, EventArgs e) { OpenIE_API.OpenUrl(Properties.Resources.Bug); }
private void tsbtnDiscus_Click(object sender, EventArgs e) { OpenIE_API.OpenUrl(Properties.Resources.Common); }
private void lnkMyPage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { OpenIE_API.OpenUrl(Properties.Resources.AuthorHomePage); }
private void btnGoIE_Click(object sender, EventArgs e) { OpenIE_API.OpenIE(_cookieContainer); }
//获取坐席信息 private void GetSeat() { submitAction.QueryString = getPostData.GetQueryOrderWaitTimeQueryString(_tokenAndLeftTicket); submitAction.BeginGetSeat((str) => { var returnString = translation.TranslationHtmlEx(str); if (returnString["messages"].Any()) { //GetRandCodeImg(); DeterMineCall(() => { lblState1.Text = returnString["messages"][0].ToString(); Application.DoEvents(); txtRandCode1.Text = ""; btnSubmit.Enabled = true; txtRandCode1.Focus(); StopSubmit(); GetToken(); }); return; } if (returnString["data"]["msg"] != null && returnString["data"]["msg"].ToString() != "") { //GetRandCodeImg(); DeterMineCall(() => { MessageBox.Show(returnString["data"]["msg"].ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRandCode1.Text = ""; btnSubmit.Enabled = true; txtRandCode1.Focus(); StopSubmit(); GetToken(); }); return; } string waitCount = ""; if (returnString["data"]["orderId"] != null && returnString["data"]["orderId"].ToString() != "") { DetermineCall(() => { _orderNo = returnString["data"]["orderId"].ToString(); if (_orderNo != "" && flag == 0) { flag++; timer2.Enabled = false; lblState1.Text = "订票成功~~!订单号为:" + _orderNo; string path = System.IO.Directory.GetCurrentDirectory() + "\\Sound_Sucessed.wav"; if (System.IO.File.Exists(path)) { sp = new System.Media.SoundPlayer(path); sp.Play(); } if (MessageBox.Show("订票成功,赶紧到网站上支付吧~~", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { if (chkOpenIE.Checked) { OpenIE_API.OpenIE(_cookieContainer); } this.Close(); } } }); } else { DetermineCall(() => { //waitCount = Regex.Match(result, "(?<=\"waitCount\":)[\\-]?\\d{1,}(?=,\")").ToString(); waitCount = returnString["data"]["waitCount"].ToString(); lblState1.Text = "据说前面还有 " + waitCount + " 个人,估计还需要等上 " + returnString["data"]["waitTime"] as string + " 秒"; // Regex.Match(result, "(?<=\"waitTime\":)[\\-]?\\d{1,}(?=,\")").ToString() + " 秒"; Application.DoEvents(); timer2.Interval = 1000; //Convert.ToInt32(_submitSpan) timer2.Start(); }); } }, _cookieContainer); }