windows phone7 火車座位臨窗計算,想看風景的有福了

來源:互聯網
上載者:User

 

每次坐火車都想靠著窗戶坐,看看風景人也舒服些,在網上找了下座位計算的方法,就做了一個小應用

注:不包括高鐵和動車

計算的代碼:

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 }

 

:http://files.cnblogs.com/lsmayday/Trainseat.xap

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.