void HandleQuerySuccess() { if (Parent == null || Parent.Parent == null) { //fix 查询过久被手动关了? return; } QueryParam.LastQuerySuccess = true; QueryParam.LastQueryTime = DateTime.Now; qr.LoadTrainResult(_worker.Result); Session.BackupOrderCart.SyncTrainSubmitInfoAsync(_worker.Result); if (_worker.AutoSelect == null && QueryParam.EnableAutoPreSubmit && QueryParam.AutoHb) { Session.GetService <IBackupOrderService>().DetectAutoHbTrainsToCart(QueryParam, _worker.Result); } //Session.DetectFaceCheckStatusByQueryResult(_worker.Result); QueryParam.LastQueryRequestTime = _worker.DataTime; ShowQueryStatus(); if (_worker.Result.Count > 0 && QueryParam.QueryCount == 1) { //自动分析别名 TrainIdAliasStorage.Instance.Update(_worker.Result.OriginalList); } //查找预选择的车次 if (_worker.AutoSelect != null) { //自动打开当前页 Session.UserProfile.QueryParams.SelectedQuery = QueryParam; MainForm.Instance.RestoreForm(); //音乐提示? if (QueryParam.EnableAutoPreSubmit) { QueryParam.HasTicket = true; MainForm.Instance.PlayTicketMusic(); } if (QueryParam.IsAutoSubmitEnabled) { var selected = _worker.AutoSelect; if (OrderConfiguration.Instance.EnableFastSubmitOrder) { var fastSubmit = new FastSubmitOrder(Session, selected.Train, selected.Seat, selected.Passengers, QueryParam, true); fastSubmit.Show(); } else { //允许自动提交? var submit = new UI.Dialogs.Order.SubmitOrder(Session, selected.Train, QueryParam, selected.Seat, QueryParam.Resign ? QueryParam.AutoPreSubmitConfig.Passenger.ToArray() : selected.Passengers, true); submit.Show(); } } //停掉所有的查询 if (Configuration.QueryConfiguration.Current.StopQueryWhenFoundTicket) { Session.UserProfile.QueryParams.RequestStopAll(); } } else if (QueryParam.IsAutoSubmitEnabled) { StartRefreshCountDown(); //席别不对 var stat = _worker.AutoSelectStat; if (stat?.IsTrainSeatMismatch == true) { this.ShowToast("警告:所选择的车次中并没有所选择要自动预定的席别!请检查自动预定车次和席别的设置!", Assets.FreeWp8Icons_White.FreeWp8IconsWhite_No_entry, Color.Firebrick, Color.White, eToastGlowColor.Red, timeout: 5000); } } else if (QueryParam.EnableAutoPreSubmit) { this.ShowToast("设置不正确,无法继续刷票。请检查自动预定车次和席别的设置!", Assets.FreeWp8Icons_White.FreeWp8IconsWhite_No_entry, Color.Firebrick, Color.White, eToastGlowColor.Red, timeout: 5000); } }
void HandleOrderRequest(QueryResultItem train, char seat) { if (!Session.IsLogined) { this.ShowInfoToast("当前查询未登录,买个屁哦。。"); return; } var data = train.TicketCount.GetTicketData(seat); //候补订票 if (data?.NoTicket == true && train.IsSeatBackupAvailable(data.Code)) { Session.GetService <IBackupOrderUiOperation>().AddToBackupOrderAsync(train, data); return; } if (!train.IsAvailable) { var backupMsg = train.AllowBackup ? ", 双击候补的席别可候补订票" : ""; var pos = PointToClient(MousePosition); if (QueryParam.EnableAutoPreSubmit) { QueryParam.AutoPreSubmitConfig.AddTrainCode(train.Code); this.ShowToast("车次【" + train.Code + "】不可购买, 已加入自动预定列表" + backupMsg, x: pos.X, y: pos.Y); } else { this.ShowToast("车次【" + train.Code + "】不可购买" + backupMsg, x: pos.X, y: pos.Y); } return; } if (seat == '\0' || data == null) { var pas = (QueryParam.IsAutoSubmitEnabled || QueryParam.Resign) ? QueryParam.AutoPreSubmitConfig.Passenger.ToArray() : null; QueryParam.PrepareTicketInfoForPassengers(train, pas, seat); var dlg = new Dialogs.Order.SubmitOrder(Session, train, QueryParam, seat, pas, false); dlg.Show(); return; } //指定的席别无票吗? if (data.NoTicket) { QueryParam.AutoPreSubmitConfig.AddTrainCode(train.Code); QueryParam.AutoPreSubmitConfig.AddSeat(seat); QueryParam.EnableAutoPreSubmit = true; this.ShowInfoToast("已将车次【" + train.Code + "】和席别【" + ParamData.SeatType[seat] + "】加入自动预定列表 :-)"); return; } if (data.NotAvailable || data.NotSell) { seat = '\0'; } //打开自动预定列表 var illegalStudent = QueryParam.QueryStudentTicket && QueryParam.AutoPreSubmitConfig.Passenger.Any(s => s.TicketType != 3); if (illegalStudent) { this.ShowToast("嘿,你选择的联系人里不全是学生,但是查询的是学生票,臭不要脸....请重新选择联系人再提交订单...", Properties.Resources.warning_16, Color.DarkRed, glowColor: eToastGlowColor.Red); } if (!illegalStudent && QueryParam.EnableAutoPreSubmit && seat != '\0' && QueryParam.AutoPreSubmitConfig.Passenger.Count > 0) { var pasfast = QueryParam.AutoPreSubmitConfig.Passenger.Take(Math.Min(data.TicketForCompute, QueryParam.AutoPreSubmitConfig.Passenger.Count)).ToArray(); QueryParam.PrepareTicketInfoForPassengers(train, pasfast, seat); var fastsubmit = new FastSubmitOrder(Session, train, seat, pasfast, QueryParam, false); fastsubmit.Show(); } else { var pas = (QueryParam.IsAutoSubmitEnabled || QueryParam.Resign) ? QueryParam.AutoPreSubmitConfig.Passenger.Take(Math.Min(data.TicketForCompute, QueryParam.AutoPreSubmitConfig.Passenger.Count)).ToArray() : null; QueryParam.PrepareTicketInfoForPassengers(train, pas, seat); var order = new Dialogs.Order.SubmitOrder(Session, train, QueryParam, seat, pas, false); order.Show(); } }