protected OrderSubmitDialogBase(Session session, QueryResultItem train, char seat, IEnumerable <PassengerInTicket> passengers, QueryParam queryParam, bool byAuto) { InitSession(session); Train = train; OriginalSeat = seat; Seat = train.FindCorrectSeat(seat);; PassengerInTickets = queryParam.PrepareTicketInfoForPassengers(train, passengers, Seat); Query = queryParam; if (Program.IsRunning) { Icon = MainForm.Instance.Icon; if (byAuto) { QueryResumeManager.Controller.Instance[session].Register(this); } } Session.Logout += Session_Logout; Session.QueueOrderCancelled += Session_QueueOrderCancelled; CaptchaLoaded += OrderSubmitDialogBase_CaptchaLoaded; OnOrderDialogOpen(this); //冲突检测 OrderDialogOpen += OrderSubmitDialogBase_OrderDialogOpen; FormClosing += (s, e) => { if (PreventCloseFlag) { this.ShowToast("窗口正在忙碌...请等待当前操作完成后再关闭。"); e.Cancel = true; return; } IsFormClosed = true; _safeTimer?.Stop(); Session.Logout -= Session_Logout; OrderDialogOpen -= OrderSubmitDialogBase_OrderDialogOpen; Session.QueueOrderCancelled -= Session_QueueOrderCancelled; }; //安全期 InitSafeTimer(); }