public QueryPage(Session session, Entity.QueryParam param) { InitializeComponent(); if (!Program.IsRunning) { return; } //High DPI if (Program.DpiY > 96.0F) { qs.Height = Program.GetScaledY(qs.Height); } InitSession(session); QueryParam = param; if (QueryParam != null) { InitQuery(); InitStartStationTip(); InitUi(); } VisibleChanged += HandleVisibleChanged; AppContext.MainForm.IsWindowVisibleChanged += HandleVisibleChanged; Disposed += (s, e) => { AppContext.MainForm.IsWindowVisibleChanged -= HandleVisibleChanged; }; }
/// <summary> /// 创建 <see cref="QueryPageContainer" /> 的新实例(QueryPageContainer) /// </summary> public QueryPageContainer(Session session, Entity.QueryParam queryParam, SuperTabControl control) { Session = session; QueryParam = queryParam; if (!Program.IsRunning) { return; } QueryPage = new QueryPage(Session, queryParam) { Dock = DockStyle.Fill, BackColor = SystemColors.Window }; _panel = new SuperTabControlPanel(); _panel.Controls.Add(QueryPage); AttachedControl = _panel; _panel.TabItem = this; _tabControl = control; var idx = control.Tabs.OfType <QueryPageContainer>().LastOrDefault(); _tabControl.CreateTab(this, _panel, idx == null ? 0 : control.Tabs.IndexOf(idx) + 1); Text = queryParam.Name; Image = Properties.Resources.calendar_16; DataBindings.Add("Text", queryParam, "Name", false, DataSourceUpdateMode.OnPropertyChanged); BindQueryState(); EnableImageAnimation = false; this.DoubleClick += QueryPageContainer_DoubleClick; }
public void Init(Entity.QueryParam param) { QueryParam = param; //初始化 InitUi(); if (param != null) { InitUiEvents(); InitSleep(); } }
public SubmitOrder(Session session, QueryResultItem train, Entity.QueryParam query, char seat, IEnumerable <PassengerInTicket> passengers, bool byAuto) : base(session, train, seat, passengers, query, byAuto) { InitializeComponent(); Icon = Properties.Resources.shoppingcart; tc.InitSession(session); ps.InitSession(session); //VerifyCodeBox = verifyCodeBox1; AttachVerifyCodeControl(tc); if (Session == null) { return; } Resign = Query.Resign; _config = Configuration.SubmitOrder.Current; //初始化票类型 _validTicketTypes = new Dictionary <int, string>(); if (Query.QueryStudentTicket) { _validTicketTypes.Add(3, "学生票"); } else { _validTicketTypes.Add(1, "成人票"); _validTicketTypes.Add(2, "儿童票"); _validTicketTypes.Add(3, "学生票"); _validTicketTypes.Add(4, "残军票"); } //初始化席别类型 var allSeatCodes = Train.TicketCount.Keys.Where(s => Train.TicketCount[s].Count > 0 && ParamData.SeatTypeFull.ContainsKey(s)).Select(s => Train.FindCorrectSeat(s)).Where(s => s != 0).Distinct().ToArray(); _validSeatTypes = allSeatCodes.ToDictionary(s => s, s => ParamData.SeatTypeFull[s]); //_validSeatTypesInTicket = _validTicketTypes.Keys.ToDictionary(s => s, s => allSeatCodes); _worker = new SubmitOrderWorker(Session, Train, Query); //_ticketQueryWorker = new TicketQueryWorker(null, Query); _queueWorker = new QueueOrderWorker(Session); _queueWorker.TourFlag = "dc"; AttachWorker(_worker, _queueWorker); //初始化事件 InitEditor(); InitSubmit(); PostInitialize(); }
public void Init(Entity.QueryParam param) { QueryParam = param; Configuration = param.AutoPreSubmitConfig; //init drag drop InitDragDrop(); //add property binding //chkEnableAutoSubmit.Checked = QueryParam.EnableAutoPreSubmit; //chkEnableAutoSubmit.CheckedChanged += (s, e) => QueryParam.EnableAutoPreSubmit = chkEnableAutoSubmit.Checked; chkEnableAutoSubmit.AddDataBinding(QueryParam, s => s.Checked, s => s.EnableAutoPreSubmit); if (param.Resign) { chkAutoHb.Visible = false; } tableLayoutPanel1.AddDataBinding(QueryParam, s => s.Enabled, s => s.EnableAutoPreSubmit); chkEnablePartialSubmit.DataBindings.Add("Checked", Configuration, "EnablePartialSubmit", false, DataSourceUpdateMode.OnPropertyChanged); chkHideOtherTrains.DataBindings.Add("Checked", Configuration, "HideOtherTrains", false, DataSourceUpdateMode.OnPropertyChanged); chkAutoVc.Checked = QueryParam.EnableAutoVC; chkAutoVc.DataBindings.Add("Checked", QueryParam, "EnableAutoVC", false, DataSourceUpdateMode.OnPropertyChanged); chkAutoHb.AddDataBinding(QueryParam, s => s.Checked, s => s.AutoHb); //chkAuto.AddDataBinding(Configuration, s => s.Checked, s => s.AutoMode); //chkAutoVc.AddDataBinding(ProgramConfiguration.Instance, s => s.Enabled, s => s.AutoSubmitOrderVcCode); //chkAutoTrain.AddDataBinding(rSeatFirst, s => s.Enabled, s => s.Checked); RefreshAutoVcStatus(); var svceh = this.SafeInvoke((s, e) => { RefreshAutoVcStatus(); }); Service.VerifyCodeRecognizeServiceLoader.OnVerifyCodeRecognizeEngineChanged += svceh; Service.VerifyCodeRecognizeServiceLoader.StateChanged += svceh; var svceh1 = ProgramConfiguration.Instance.AddPropertyChangedEventHandler(s => s.AutoSubmitOrderVcCode, (s, e) => RefreshAutoVcStatus()); Disposed += (s, e) => { Service.VerifyCodeRecognizeServiceLoader.OnVerifyCodeRecognizeEngineChanged -= svceh; Service.VerifyCodeRecognizeServiceLoader.StateChanged -= svceh; svceh1(); }; //chkAuto.CheckedChanged += (s, e) => //{ // if (chkAuto.Checked) // Information("警告:此功能随时可能会被失效,请不要依赖此选项,非必要时刻不建议选择。"); //}; if (Configuration.SeatFirst) { rSeatFirst.Checked = true; } else { rTrainFirst.Checked = true; } rTrainFirst.CheckedChanged += (s, e) => { if (rTrainFirst.Checked) { Configuration.SeatFirst = false; } }; rSeatFirst.CheckedChanged += (s, e) => { if (rSeatFirst.Checked) { Configuration.SeatFirst = true; } }; //btnPreVerifyCode.Click += btnPreVerifyCode_Click; //btnPreVerifyCode.AddDataBinding(ProgramConfiguration.Instance, s => s.Visible, s => s.EnablePreEnterVcCode); //chkEnableSCSLoop.AddDataBinding(QueryParam, s => s.Checked, s => s.EnableSameCityStationLoop); InitTrainEditor(); InitPassengerEdit(); InitSeatEditor(); InitStatusCheck(); InitSeatSubTypeEditor(); }