Exemplo n.º 1
0
        protected override void InitTrainInfoDisplay()
        {
            lblError.Text = PassengerInTickets.Select(s => $"<b><font color=\"#049B59\">{s.Name}</font></b> ({ParamData.GetTicketType(s.TicketType).DisplayName}/{ParamData.SeatTypeFull[Seat]}/{ParamData.PassengerIdType[s.IdType]})").JoinAsString(" ");

            base.InitTrainInfoDisplay();
        }
Exemplo n.º 2
0
        public OrderNotification(Session session, QueryParam query, QueryResultItem train, IEnumerable <PassengerInTicket> passengers, string error, string orderid)
        {
            _query      = query;
            _train      = train;
            _passengers = passengers;
            _error      = error;
            _orderid    = orderid;
            InitializeComponent();

            InitSession(session);
            Icon = Properties.Resources.icon_warning;
            imglist.Images.Add(UiUtility.Get24PxImageFrom16PxImg(Properties.Resources.user_16));

            lblTrainCode.Text = train.Code;
            lblDate.Text      = train.FromStation.DepartureTime.Value.ToString("M月d日");
            lblFrom.Text      = train.FromStation.StationName;
            lblTo.Text        = train.ToStation.StationName;
            lblTimeInfo.Text  = lblTimeInfo.Text.FormatWith(
                train.FromStation.DepartureTime.Value.ToString("HH:mm"),
                train.ToStation.ArriveTime.Value.ToString("HH:mm"),
                train.ElapsedTime.ToString("dd'天'hh'时'mm'分'"));

            if (passengers != null)
            {
                lstPas.Items.AddRange(passengers.Select(s => new ListViewItem(new[]
                {
                    ParamData.GetTicketType(s.TicketType).DisplayName,
                    ParamData.SeatTypeFull[s.SeatType],
                    s.Name,
                    ParamData.PassengerIdType[s.IdType],
                    s.IdNo
                })
                {
                    ImageIndex = 0
                }).ToArray());
            }

            if (string.IsNullOrEmpty(error))
            {
                Gif.SetSuccessImage(pbAnimate);
                lblError.ForeColor = Color.RoyalBlue;
                lblError.Text      = "订票成功!订单号为:" + orderid.DefaultForEmpty("<未知>") + ",请尽快付款!如果订单没有立刻查询到,请刷新订单列表!";

                btnOK.Click += btnOK_Click;
                btnOK.Text   = "乖~~戳我去付款啦~~要截图留念请速度并打码哦 ლ(^o^ლ) ";

                Operation.Instance.PlayMusicForSuccess();
            }
            else
            {
                lblError.Text = error;
                btnOK.Text    = "同学不哭,站起来擦干眼泪继续刷 ლ(╹◡╹ლ)";
                Gif.SetFailedImage(pbAnimate);
                btnOK.Click += (s, e) => Close();

                if (error.IndexOf("未完成") != -1)
                {
                    session.OnRequestShowPanel(PanelIndex.Orders);
                    session.OnOrderChanged();
                }
            }

            if (ProgramConfiguration.Instance.OrderDlgCenterMainform)
            {
                UiUtility.PlaceFormAtCenter(this, show: false);
            }
            else
            {
                StartPosition = FormStartPosition.CenterScreen;
            }
            FormPlacementManager.Instance.Control(this);

            Load += async(s, e) =>
            {
                WindowState = FormWindowState.Normal;
                BringToFront();
                Activate();

                if (_error.IsNullOrEmpty())
                {
                    await CheckNotification().ConfigureAwait(true);
                    await SendWebNotification().ConfigureAwait(true);
                }
            };
        }