zoukankan      html  css  js  c++  java
  • 火车时刻表源代码

    1234

    这个应用的皮肤跟上一个手机归属地查询是同一皮肤,这里我用的是Panorama全景视图做的UI。

    其实我一开始是将很多查询类的小应用集中在一个应用里面的,就像这样

    tt不过后来打算分开做的,至于为什么,你懂的,5送一哦。可惜好事总是轮不上咱。通过再多也没用。

    下载地址:

    http://115.com/file/dp7nntwg#
    PracticalSearch.xap

    联系QQ:29992379

    回到正题,这个应用用的是webxml的服务。

    http://webservice.webxml.com.cn/WebServices/TrainTimeWebService.asmx

    可以通过出发站和目的站来查询列车的车次。也可以通过车次查询列车的起始站和终点站。

    之类应用都很简单,代码量也少,我在UI上花了不少功夫。效果的代码就不写了,只写功能代码吧。

     

    通过起始站和终点站查询

    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    privatevoid SearchByStationName_Click(objectsender, RoutedEventArgs e)
            {
                if(CheckStartStation() && CheckArriveStation())
                {
                    l.Show(this,"查找中......");
                    client.getStationAndTimeByStationNameAsync(StartStation.Text, ArriveStation.Text, "");
                    client.getStationAndTimeByStationNameCompleted += newEventHandler<TrainService.getStationAndTimeByStationNameCompletedEventArgs>(client_getStationAndTimeByStationNameCompleted);
                }
            }

     

    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    voidclient_getStationAndTimeByStationNameCompleted(objectsender, TrainService.getStationAndTimeByStationNameCompletedEventArgs e)
            {
                if(e.Error==null)
                {
                    var re=e.Result.Nodes[0];
                    var TimeTable = from zip inre.Descendants("TimeTable")
                                  selectnewTrainInfo
                                  {
                                      TrainCode = zip.Element("TrainCode").Value,
                                      FirstStation = zip.Element("FirstStation").Value,
                                      LastStation = zip.Element("LastStation").Value,
                                      StartStation = zip.Element("StartStation").Value,
                                      StartTime = zip.Element("StartTime").Value,
                                      ArriveStation = zip.Element("ArriveStation").Value,
                                      ArriveTime = zip.Element("ArriveTime").Value
                                  };
                    if(TimeTable.First().FirstStation=="数据没有被发现")
                    {
                        MessageBox.Show("数据没有被发现"); l.Hide(this,"");
                        return;
                    }
                    List<TrainInfo> trainlist = newList<TrainInfo>();
                    foreach(var item inTimeTable)
                    {
                        trainlist.Add(item);
                    }
                    ListBoxTrainList.ItemsSource = trainlist;
                    l.Hide(this,"");
                }
            }

     

    通过车次号查询

    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    privatevoid SearchByTrainCode_Click(objectsender, RoutedEventArgs e)
            {
                if(CheckTrainCode())
                {
                    l.Show(this,"查找中......");
                    client.getStationAndTimeByTrainCodeAsync(TrainCode.Text,"");
                    client.getStationAndTimeByTrainCodeCompleted += newEventHandler<TrainService.getStationAndTimeByTrainCodeCompletedEventArgs>(client_getStationAndTimeByTrainCodeCompleted);
                }
            }
     
            voidclient_getStationAndTimeByTrainCodeCompleted(objectsender, TrainService.getStationAndTimeByTrainCodeCompletedEventArgs e)
            {
                if(e.Error==null)
                {
                    string[] strinfo = e.Result;
                    if(strinfo[1] != "数据没有被发现")
                    {
                        TextBlockTrainCode.Text = "车次:"+ strinfo[0];
                        TextBlockTrainLiu.Text = strinfo[2]+"("+strinfo[4]+")-->"+strinfo[3]+"("+strinfo[6]+")";
                        l.Hide(this,"查找中......");
                    }
                    else
                    {
                        MessageBox.Show("数据没有被发现");
                    }
                }
            }
    文章源地址:http://www.cnblogs.com/wildfeng/archive/2012/03/24/2412514.html
  • 相关阅读:
    js弹出文字
    javascript函数的使用
    php笔记-双引号内的变量会被解释,而单引号内的变量则原样输出
    单独编译源码树下的模块
    内核模块开机自动加载和黑名单
    [转]Linux中设置服务自启动的三种方式
    rpm打包
    APC to USB
    [转]创建一个虚拟盘
    编译打印输出重定向
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/2457995.html
Copyright © 2011-2022 走看看