コード例 #1
0
        /// <summary>
        /// 订票失败
        /// </summary>
        /// <param name="error">错误信息</param>
        /// <param name="isQueue">是排队后的信息还是排队前信息</param>
        protected override async Task OrderFailedAsync(string error, bool isQueue)
        {
            Gif.SetFailedImage(pbAnimate);
            ts.ApplyColorSchema(RowStyleType.Red);


            var msg = (isQueue ? "出票失败" : "提交失败") + ":" + error + MessageTranslator.GetAdditionalInfo(error);

            ts.Text  = msg;
            ts.Image = Properties.Resources.cou_16_block;
            ShowError(msg);

            await base.OrderFailedAsync(error, isQueue).ConfigureAwait(true);
        }
コード例 #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);
                }
            };
        }
コード例 #3
0
 protected override async Task PrepareFailed(string error)
 {
     Gif.SetFailedImage(pbAnimate);
     ShowError(error);
     await base.PrepareFailed(error).ConfigureAwait(true);
 }