コード例 #1
0
        void _client_RequestOrderCompleted(object sender, RequestOrderEventArgs e)
        {
            if (e.TicketInfo == null)
            {
                return;
            }

            Passenger[] passengers = this.lvPassenger.Tag as Passenger[];
            if (passengers == null || passengers.Length <= 0)
            {
                return;
            }

            string seat   = TicketUtil.CardTypeToHtmlString("seat", e.TicketInfo.limitBuySeatTicketDTO.seat_type_codes);
            string ticket = TicketUtil.CardTypeToHtmlString("ticket_type", e.TicketInfo.limitBuySeatTicketDTO.ticket_type_codes);

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < passengers.Length; i++)
            {
                sb.Append(passengers[i].PassengerToHtmlString(i + 1, seat, ticket));
            }

            string document = ParseOrderDocument(e.TicketInfo.queryLeftTicketRequestDTO.ToHtmlString(), e.TicketInfo.leftDetails.Aggregate((l, r) => { return(l + " " + r); }), sb.ToString());

            ShowOrderInfo(document);
        }
コード例 #2
0
        private void ShowNetwork()
        {
            Task t = new Task(() =>
            {
                while (true)
                {
                    var roundtripTime = TicketUtil.CheckNetwork();
                    string state      = "极好";

                    if (roundtripTime > 400)
                    {
                        state = "1级";
                        SetControlImage(this.tsbtnNetwork, global::Ticket.Properties.Resources.wifi1);
                    }
                    else if (roundtripTime > 300 && roundtripTime < 400)
                    {
                        state = "2级";
                        SetControlImage(this.tsbtnNetwork, global::Ticket.Properties.Resources.wifi2);
                    }
                    else if (roundtripTime > 200 && roundtripTime < 300)
                    {
                        state = "3级";
                        SetControlImage(this.tsbtnNetwork, global::Ticket.Properties.Resources.wifi3);
                    }
                    else if (roundtripTime > 100 && roundtripTime < 200)
                    {
                        state = "4级";
                        SetControlImage(this.tsbtnNetwork, global::Ticket.Properties.Resources.wifi4);
                    }
                    else if (roundtripTime < 100)
                    {
                        state = "5级";
                        SetControlImage(this.tsbtnNetwork, global::Ticket.Properties.Resources.wifi5);
                    }

                    if (isExit)
                    {
                        break;
                    }

                    SetControlTip(this.tsbtnNetwork, string.Format("响应时间: {0}毫秒", roundtripTime));
                    SetControlText(this.tsbtnNetwork, state);
                    System.Threading.Thread.Sleep(5000);
                }
            });

            t.ContinueWith((task) =>
            {
                //log task.Exception
            }, TaskContinuationOptions.OnlyOnFaulted);

            t.Start();
        }
コード例 #3
0
        private void ShowIpAddress()
        {
            Task t = new Task(() =>
            {
                SetControlText(this.tsbtnIpAddress, TicketUtil.GetIpAddress());
            });

            t.ContinueWith((task) =>
            {
                //log task.Exception
            }, TaskContinuationOptions.OnlyOnFaulted);

            t.Start();
        }
コード例 #4
0
        public FrmMain()
        {
            InitializeComponent();
            Init();

            this.ShowInTaskbar               = false;
            this.webBrowserOrder.Visible     = false;
            this.llblQueryOption.Click      += new EventHandler(llblQueryOption_Click);
            this.llblPrevDate.Click         += new EventHandler(llblPrevDate_Click);
            this.llblNextDate.Click         += new EventHandler(llblNextDate_Click);
            this.llblSelectPassengers.Click += new EventHandler(llblSelectPassengers_Click);
            this.llblRemovePassenger.Click  += new EventHandler(llblRemovePassenger_Click);
            this.llblAddChild.Click         += new EventHandler(llblAddChild_Click);
            this.llblCopyPassenger.Click    += new EventHandler(llblCopyPassenger_Click);
            this.llblExportPassengers.Click += new EventHandler(llblExportPassengers_Click);
            this.tsbtnLogin.Click           += new EventHandler(tsbtnLogin_Click);
            this.btnQuery.Click             += new EventHandler(btnQuery_Click);
            this.btnSelfQuery.Click         += new EventHandler(btnSelfQuery_Click);
            this.tsbtnCancellation.Click    += new EventHandler(tsbtnCancellation_Click);
            this.btnSubmitOrder.Click       += new EventHandler(btnSubmitOrder_Click);
            this.lvPassenger.Click          += new EventHandler(lvPassenger_Click);
            this.FormClosing += new FormClosingEventHandler(FrmMain_FormClosing);

            ShowQueryOption(false);
            ShowIpAddress();
            ShowNetwork();
            ShowTimer();
            ShowSelectPassengers(TicketUtil.ReadSelectedPassengers());

            InitClient();
            InitPassengerListView();
            ShowSelectPassengers();
            ShowQueryOption(Setting.GetInstance().QueryOption);

            this.webBrowser.DocumentText       = default_document;
            this.webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);
        }
コード例 #5
0
ファイル: TicketUtil.cs プロジェクト: windygu/Ticket
 public static string ParamEncrypt(string key, string data)
 {
     return(TicketUtil.Encode32(TicketUtil.ToHex(TicketUtil.Encrypt(key, data))));
 }
コード例 #6
0
 void frmSelectPassenger_PassengersSeletedCompleted(object sender, PassengerEventArgs e)
 {
     ShowSelectPassengers(e.Passengers);
     TicketUtil.SaveSelectedPassengers(e.Passengers);
 }