示例#1
0
        private async void button1_Click(object sender, RoutedEventArgs e)
        {
            //开始查询
            //if (comboBox.SelectedIndex == -1 || comboBoxMuDiDi.SelectedIndex == -1)
            //{
            //    MessageDialog message = new MessageDialog("请选择初始地或者目的地");
            //    await message.ShowAsync();
            //    return;
            //}
            //diMing fromDiMing = comboBox.SelectedItem as diMing;
            //diMing toDiMing = comboBoxMuDiDi.SelectedItem as diMing;
            diMing fromDiMing = autoSuggesChuFa.Tag as diMing;
            diMing toDiMing   = autoSuggesMuDiDi.Tag as diMing;

            if (toDiMing == null || fromDiMing == null)
            {
                MessageDialog message = new MessageDialog("请选择初始地或者目的地");
                await message.ShowAsync();

                return;
            }
            //https://kyfw.12306.cn/otn/leftTicket/query?leftTicketDTO.train_date=2015-10-26&leftTicketDTO.from_station=SHH&leftTicketDTO.to_station=ZZF&purpose_codes=ADULT

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("leftTicketDTO.train_date", datePicker.Date.Year + "-" + datePicker.Date.Month.ToString("00") + "-" + datePicker.Date.Day.ToString("00"));
            dic.Add("leftTicketDTO.from_station", fromDiMing.code);
            dic.Add("leftTicketDTO.to_station", toDiMing.code);
            dic.Add("purpose_codes", "ADULT");

            this.frame.Navigate(typeof(JYChePiaoListPage), dic);
        }
示例#2
0
        /**
         * 获得站点信息
         */
        void getZhanDianXinXi()
        {
            string uri = "http://www.web2mi.com/train/station.js";

            HTTPRequest.init().sendGetHtml(uri, null, (string json) => {
                Debug.Write(json);
                string[] arr = json.Split('@');

                foreach (string str in arr)
                {
                    if (str == "")
                    {
                        continue;
                    }
                    string[] strArr = str.Split('|');
                    diMing di       = new diMing();
                    if (strArr.Length == 4)
                    {
                        di.pinyin        = strArr[0];
                        di.nameforcon    = strArr[1];
                        di.code          = strArr[2];
                        di.qiShoushiJian = strArr[3];
                    }
                    if (strArr.Length == 3)
                    {
                        di.pinyin     = strArr[0];
                        di.nameforcon = strArr[1];
                        di.code       = strArr[2];
                    }
                    diming.Add(di);
                    suggesArr.Add(di);
                }
            }, (string err) =>
            {
                Debug.Write(err);
            });
        }