火车时刻表源代码
来源:互联网 发布:光大证券炒股软件 编辑:程序博客网 时间:2024/04/26 18:50
这个应用的皮肤跟上一个手机归属地查询是同一皮肤,这里我用的是Panorama全景视图做的UI。
其实我一开始是将很多查询类的小应用集中在一个应用里面的,就像这样
不过后来打算分开做的,至于为什么,你懂的,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
private
void
SearchByStationName_Click(
object
sender, RoutedEventArgs e)
{
if
(CheckStartStation() && CheckArriveStation())
{
l.Show(
this
,
"查找中......"
);
client.getStationAndTimeByStationNameAsync(StartStation.Text, ArriveStation.Text,
""
);
client.getStationAndTimeByStationNameCompleted +=
new
EventHandler<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
void
client_getStationAndTimeByStationNameCompleted(
object
sender, TrainService.getStationAndTimeByStationNameCompletedEventArgs e)
{
if
(e.Error==
null
)
{
var re=e.Result.Nodes[0];
var TimeTable = from zip
in
re.Descendants(
"TimeTable"
)
select
new
TrainInfo
{
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 =
new
List<TrainInfo>();
foreach
(var item
in
TimeTable)
{
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
private
void
SearchByTrainCode_Click(
object
sender, RoutedEventArgs e)
{
if
(CheckTrainCode())
{
l.Show(
this
,
"查找中......"
);
client.getStationAndTimeByTrainCodeAsync(TrainCode.Text,
""
);
client.getStationAndTimeByTrainCodeCompleted +=
new
EventHandler<TrainService.getStationAndTimeByTrainCodeCompletedEventArgs>(client_getStationAndTimeByTrainCodeCompleted);
}
}
void
client_getStationAndTimeByTrainCodeCompleted(
object
sender, 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(
"数据没有被发现"
);
}
}
}
- 火车时刻表源代码
- 火车时刻表又更新了!
- 原创,PHP简单的查询火车时刻表程序
- Android获得火车时刻表Web Services的全部始发站名称
- 一些常用的WebServices 天气,IP,邮编,Email,火车时刻表,股票 等等!
- 一些常用的WebServices 天气,IP,邮编,Email,火车时刻表,股票 等等
- 一些常用的WebServices 天气,IP,邮编,Email,火车时刻表,股票 等等
- 常用WebServices 天气,IP,邮编,Email,火车时刻表,股票 web接口服务
- 常用WebServices 天气,IP,邮编,Email,火车时刻表,股票 web接口服务
- android调用webXml 查询发车站和到达站查询火车时刻表
- 源代码
- 源代码
- 源代码
- 源代码
- 源代码
- 源代码
- 源代码
- 源代码
- POJ 3372 Candy Distribution 完全剩余系/奇偶性
- Perl 学习笔记(10)-- 智能匹配和given-when
- Debian 上面配置Clojure和emacs
- Perl 学习笔记(11) -- 进程管理及其他
- 用Gvim建立IDE编程环境 (Windows篇)
- 火车时刻表源代码
- Linux Kernel中list解读
- Perl 学习笔记(12) -- 引用
- 给服务器设置DNS
- 网络理论知识
- 关于php能动态输出哪些内容以及四种风格标签说明
- C语言 写文件操作
- Perl 学习笔记(13) -- 面向对象的perl(包和模块)
- lodop批量打印小bug