private void DoQuery() { qe.optionDates.Clear(); this.BeginInvoke(new MethodInvoker(delegate() { for (int i = 0; i < this.plSelectDates.Controls.Count; i++) { LinkLabel ll = this.plSelectDates.Controls[i] as LinkLabel; string date = ll.Text; if (!qe.optionDates.Contains(date)) { qe.optionDates.Add(date); } } })); DataTable dt = null; do { if (this.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { this.btnQuery.Enabled = false; this.lbLoding.BringToFront(); this.lbLoding.Visible = true; this.plNoTicket.Hide(); })); } dt = TicketHelper.GetLeftTicket(ref qe); this.BeginInvoke(new MethodInvoker(delegate() { this.lbLoding.Visible = false; dgTicket.DataSource = dt; dgTicket.ClearSelection(); lbQueryInfo.Text = qe.from_station_telecode_name + "-->" + qe.to_station_telecode_name + "(" + qe.train_date + " " + Common.GetWeekDay(Convert.ToDateTime(qe.train_date)) + ")共计" + dt.Rows.Count + "个车次"; if (dt.Rows.Count == 0) { this.plNoTicket.Show(); this.plNoTicket.Location = this.lbLoding.Location; } })); if (dt.Rows.Count > 0) { if (!autoBuyFlag) { if (this.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { //保存 UserManager.SaveUserInfo(StaticValues.MyUser.UserName, StaticValues.MyUser.Pwd, qe.from_station_telecode_name, qe.to_station_telecode_name); mp3 = new Mp3Helper(); mp3.FileName = "succes.mp3"; mp3.Play(); TipForm tf = new TipForm("恭喜你,有票了,赶快去预订吧!", "有票了"); tf.Show(); })); } } else { AutoBuyTipForm atf = new AutoBuyTipForm(dt, qe, myList); atf.ShowDialog(); } } ControlQueryRate(timeSpan); }while (autoFlag && dt.Rows.Count == 0); this.BeginInvoke(new MethodInvoker(delegate() { btnQuery.Enabled = true; })); }
private void DoQuery() { qe.optionDates.Clear(); this.BeginInvoke(new MethodInvoker(delegate() { for (int i = 0; i < this.plSelectDates.Controls.Count; i++) { LinkLabel ll = this.plSelectDates.Controls[i] as LinkLabel; string date = ll.Text; if (!qe.optionDates.Contains(date)) { qe.optionDates.Add(date); } } })); DataTable dt = null; do { if (this.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { this.btnQuery.Enabled = false; this.lbLoding.BringToFront(); this.lbLoding.Visible = true; this.plNoTicket.Hide(); })); } dt = TicketHelper.GetLeftTicket(ref qe); this.BeginInvoke(new MethodInvoker(delegate() { this.lbLoding.Visible = false; dgTicket.DataSource = dt; dgTicket.ClearSelection(); lbQueryInfo.Text =qe.from_station_telecode_name+"-->"+qe.to_station_telecode_name+"("+qe.train_date+" "+Common.GetWeekDay(Convert.ToDateTime(qe.train_date))+")共计"+dt.Rows.Count+"个车次"; if (dt.Rows.Count == 0) { this.plNoTicket.Show(); this.plNoTicket.Location = this.lbLoding.Location; } })); if (dt.Rows.Count > 0) { if (!autoBuyFlag) { if (this.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { //保存 UserManager.SaveUserInfo(StaticValues.MyUser.UserName, StaticValues.MyUser.Pwd, qe.from_station_telecode_name, qe.to_station_telecode_name); mp3 = new Mp3Helper(); mp3.FileName = "succes.mp3"; mp3.Play(); TipForm tf = new TipForm("恭喜你,有票了,赶快去预订吧!", "有票了"); tf.Show(); })); } } else { AutoBuyTipForm atf = new AutoBuyTipForm(dt,qe,myList); atf.ShowDialog(); } } ControlQueryRate(timeSpan); } while (autoFlag&&dt.Rows.Count==0); this.BeginInvoke(new MethodInvoker(delegate() { btnQuery.Enabled = true; })); }