windows phone7 火车座位临窗计算,想看风景的有福了

 

每次坐火车都想靠着窗户坐,看看风景人也舒服些,在网上找了下座位计算的方法,就做了一个小应用

注:不包括高铁和动车

计算的代码:

View Code
 1             int Num;
2 if (int.TryParse(this.phoneTextBox_Num.Text.ToString(), out Num))
3 {
4 Debug.WriteLine(Num.ToString());
5 if (Num > 0 && Num <= 118)
6 {
7 if (Num == 1 || Num == 4 || Num == 114 || Num == 118)
8 {
9 this.textBlock_Out.Text = "您查询的座位临窗";
10 Debug.WriteLine("靠窗:" + Num.ToString() + "");
11 }
12 else
13 {
14 if (Num > 4 || Num < 114)
15 {
16 //座位号码减去4除以5余1或0的座位均为靠窗座位,其中余0者为两座临窗,余1者为三座临窗。
17 if ((Num - 4) % 5 == 1)
18 {
19 this.textBlock_Out.Text = "您查询的座位两座临窗";
20 Debug.WriteLine("两座靠窗:" + Num.ToString() + "");
21 }
22 else if ((Num - 4) % 5 == 0)
23 {
24 this.textBlock_Out.Text = "您查询的座位三座临窗";
25 Debug.WriteLine("三座靠窗:" + Num.ToString() + "");
26 }
27 else
28 {
29 this.textBlock_Out.Text = "您查询的座位不临窗";
30 Debug.WriteLine("不靠窗:" + Num.ToString() + "");
31 }
32 }
33 }
34 }
35 else {
36 this.textBlock_Out.Text = "您输入的座位号不正确";
37 }
38 }
39 else
40 {
41 this.phoneTextBox_Num.Text = "";
42 MessageBox.Show("请输入数字!");
43 }

 

下载地址:https://files.cnblogs.com/lsmayday/Trainseat.xap

 

posted @ 2011-11-20 09:28  十年一刻·i  阅读(881)  评论(4编辑  收藏  举报